Closed dkbhadeshiya closed 5 months ago
Same behaviour happened while using crypto.randomUUID()
function.
[redacted]/test-bench/node_modules/tinybench/dist/index.cjs:386
"ops/sec": parseInt(e.hz.toString(), 10).toLocaleString(),
^
TypeError: Cannot read properties of undefined (reading 'toString')
at [redacted]/test-bench/node_modules/tinybench/dist/index.cjs:386:32
at Array.map (<anonymous>)
at u.table ([redacted]/test-bench/node_modules/tinybench/dist/index.cjs:384:23)
at [redacted]/test-bench/crypt-uuid.js:11:25
Node.js v21.5.0
Script for testing crypto.randomUUID()
const { Bench } = require('tinybench');
const { randomUUID } = require('crypto');
const bench = new Bench({ time: 10000 });
bench
.add('Generate ID', () => {
randomUUID();
});
bench.run().then(() => {
console.table(bench.table());
})
Looks like this should be fixed by now https://github.com/tinylibs/tinybench/commit/ab950e03ccac536b4d382433f6dc410ad3360933#diff-c19b4a9aa70c935caded8b62cdaf76680cf0034fdc146a383a60ed2607c854c9R164-R167
@Aslemammad, could you release a new version?
Looks like this should be fixed by now https://github.com/tinylibs/tinybench/commit/ab950e03ccac536b4d382433f6dc410ad3360933#diff-c19b4a9aa70c935caded8b62cdaf76680cf0034fdc146a383a60ed2607c854c9R164-R167
@Aslemammad, could you release a new version?
Thank you so much, do you want to be a member of tinylibs?
Hi,
I have been trying to run a benchmark on crypto.randomUUID vs uuid.v4() function.
I hit the following error:
Here is my sample script which I am using to do the testing: