Repository navigation
Fix benchmark for fast functions - #620
Conversation
|
New results from CI (Node.js 26, Docker image in some low-level VPS): Is it ok for you? |
|
Can you also put numbers from CI to |
Yes, looks good to me. I added the CI numbers to all README.*.md files. |
|
Let's replace with just Thanks |
|
Done, all README files now say "Faster than native I also found a mistake in my benchmark change, sorry about that. I used Now the script divides the total number of calls by the total time: So the README numbers from the last CI run are too high, mostly for |
Closes #619
tinybench times every call on its own. For fast functions, reading the timer takes longer than the function, so the results stopped near the same number (about 20M ops/sec in the README).
Now every task calls the function 1000 times in a loop, and the result is multiplied by 1000. The results are kept in an array, so V8 cannot skip creating the IDs.
Results on my machine (Apple M2, Node 22.22.2):
crypto.randomUUIDanduuid v4go down. I checked both with a plain loop (one timer for 2M calls) and got similar numbers (crypto.randomUUIDabout 8.7M,uuid v4about 7.8M ops/sec), so the old method showed them too high. Their numbers change a bit between runs (about 6.5M to 9M).I did not change the README numbers. The Benchmark workflow runs on this PR, so the new numbers will be in its log.
Checked:
pnpm testpasses, andoxfmt --check test/benchmark.jsis clean.