"dependencies": {
"benchmark": "^2.1.4",
"benny": "^3.7.1",
- "microtime": "^3.1.1"
+ "microtime": "^3.1.1",
+ "uuid": "^9.0.0",
+ "uuidv4": "^6.2.13"
},
"devDependencies": {
"eslint": "^8.26.0",
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
"dev": true
},
+ "node_modules/@types/uuid": {
+ "version": "8.3.4",
+ "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz",
+ "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw=="
+ },
"node_modules/acorn": {
"version": "8.8.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz",
"punycode": "^2.1.0"
}
},
+ "node_modules/uuid": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",
+ "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==",
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
+ "node_modules/uuidv4": {
+ "version": "6.2.13",
+ "resolved": "https://registry.npmjs.org/uuidv4/-/uuidv4-6.2.13.tgz",
+ "integrity": "sha512-AXyzMjazYB3ovL3q051VLH06Ixj//Knx7QnUSi1T//Ie3io6CpsPu9nVMOx5MoLWh6xV0B9J0hIaxungxXUbPQ==",
+ "dependencies": {
+ "@types/uuid": "8.3.4",
+ "uuid": "8.3.2"
+ }
+ },
+ "node_modules/uuidv4/node_modules/uuid": {
+ "version": "8.3.2",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
+ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
"dev": true
},
+ "@types/uuid": {
+ "version": "8.3.4",
+ "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz",
+ "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw=="
+ },
"acorn": {
"version": "8.8.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz",
"punycode": "^2.1.0"
}
},
+ "uuid": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",
+ "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg=="
+ },
+ "uuidv4": {
+ "version": "6.2.13",
+ "resolved": "https://registry.npmjs.org/uuidv4/-/uuidv4-6.2.13.tgz",
+ "integrity": "sha512-AXyzMjazYB3ovL3q051VLH06Ixj//Knx7QnUSi1T//Ie3io6CpsPu9nVMOx5MoLWh6xV0B9J0hIaxungxXUbPQ==",
+ "requires": {
+ "@types/uuid": "8.3.4",
+ "uuid": "8.3.2"
+ },
+ "dependencies": {
+ "uuid": {
+ "version": "8.3.2",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
+ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
+ }
+ }
+ },
"which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"benchmark:promise-handling": "node promise-handling.js",
"benchmark:fibonacci": "node fibonacci.js",
"benchmark:random": "node random.js",
+ "benchmark:uuid-generator": "node uuid-generator.js",
"format": "prettier . --write; standard . --fix",
"lint": "eslint . --cache",
"lint:fix": "eslint . --cache --fix",
"dependencies": {
"benchmark": "^2.1.4",
"benny": "^3.7.1",
- "microtime": "^3.1.1"
+ "microtime": "^3.1.1",
+ "uuid": "^9.0.0",
+ "uuidv4": "^6.2.13"
},
"devDependencies": {
"eslint": "^8.26.0",
--- /dev/null
+const Benchmark = require('benny')
+const crypto = require('crypto')
+const { v4: uuidv4 } = require('uuid')
+const { uuid } = require('uuidv4')
+
+Benchmark.suite(
+ 'UUIDv4 generator',
+ Benchmark.add('crypto randomUUID', () => {
+ crypto.randomUUID()
+ }),
+ Benchmark.add('uuid', () => {
+ uuidv4()
+ }),
+ Benchmark.add('uuidv4', () => {
+ uuid()
+ }),
+ Benchmark.cycle(),
+ Benchmark.complete(),
+ Benchmark.save({
+ file: 'uuid-generator',
+ format: 'json',
+ details: true
+ }),
+ Benchmark.save({
+ file: 'uuid-generator',
+ format: 'chart.html',
+ details: true
+ }),
+ Benchmark.save({
+ file: 'uuid-generator',
+ format: 'table.html',
+ details: true
+ })
+)