Repository navigation
[Tests] add a benchmark suite - #527
Conversation
`npm run benchmark` benchmarks HEAD against every `vX.Y.Z` tag, several tags in parallel, and reports each version's parse and stringify speed relative to HEAD at the end. Each tag runs in its own process alongside HEAD, alternating case by case, so the ratios hold up under parallel load. See `npm run benchmark -- --help` for options. CI runs it on every push and PR, not to gate on speed, but to ensure every version's benchmarks complete. Benchmarks are from ljharb#527. Co-authored-by: Mohamed <[email protected]> Co-authored-by: Jordan Harband <[email protected]>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
I added most of the comments, will find a way for the GHA @ljharb |
ljharb
left a comment
There was a problem hiding this comment.
this seems to be only running benchmarks in node 20.
what versions should it run on ? |
all of them |
|
Currently, the benchmarking scripts use some modern features (e.g., Array.from, async/await) and rely on tools that are not compatible with 0.8 like Benchmark.js which I use for benchmarking, which only supports node 0.10. So, is compatibility with Node 0.8 for the benchmarking infrastructure is a hard requirement ? @ljharb |
|
I can definitely live with only going down to 0.10. https://npmjs.com/array.from should cover that one, and async/await can be done with Promises instead, which are polyfillable. |
|
Hi @ljharb |
|
Sorry for the long delay. If you could rebase this and resolve the conflicts, I can give it a new review. |
`npm run benchmark` benchmarks HEAD against every `vX.Y.Z` tag, several tags in parallel, and reports each version's parse and stringify speed relative to HEAD at the end. Each tag runs in its own process alongside HEAD, alternating case by case, so the ratios hold up under parallel load. Options: `--since <tag>`, `--tags <a,b>`, `--max-time <seconds>` (default 1), `--concurrency <n>` (default: available parallelism minus 1), `--cases` for per-case ratios, and `--parse`, `--stringify`, or `--stress`. Benchmarks are from ljharb#527.
ljharb
left a comment
There was a problem hiding this comment.
Thanks for all the work on this, and sorry again that it sat so long!
I rebased this onto main and reworked it so it can land now. A gate that compares absolute ops/sec against a committed baseline can't work across CI runners and node versions, and the --baseline option never actually reached the runners anyway, so the baseline file, the results/trend reporting, and the CI workflow are gone. The fixtures and the parse/stringify cases are all yours; I just reformatted them for the current lint config and made benchmark a root dev dep.
npm run benchmark now benchmarks HEAD against every tagged version, several at a time, and reports each version's speed relative to HEAD at the end. Each tag runs in its own process alongside HEAD, so the ratios stay meaningful under parallel load.
LGTM, thanks!
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #527 +/- ##
===========================================
- Coverage 100.00% 93.07% -6.93%
===========================================
Files 9 14 +5
Lines 3443 3699 +256
Branches 336 360 +24
===========================================
Hits 3443 3443
- Misses 0 256 +256 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
`npm run benchmark` benchmarks HEAD against every `vX.Y.Z` tag, several tags in parallel, and reports each version's parse and stringify speed relative to HEAD at the end. Each tag runs in its own process alongside HEAD, alternating case by case, so the ratios hold up under parallel load. See `npm run benchmark -- --help` for options. CI runs it on every push and PR, not to gate on speed, but to ensure every version's benchmarks complete. Benchmarks are from ljharb#527. Co-authored-by: Mohamed <[email protected]> Co-authored-by: Jordan Harband <[email protected]>
317a1ad to
6e4a151
Compare
Motivation
As discussed here #526 for prformance optimiztions, that there should be a benchmarking infrastructure:
• Execute on every Node.js version in the test matrix
• Prevent future performance regressions
• Provide data-driven evidence for performance claims