lib/*.js (benchmark): expose benchmark functionality as a module - #44974
lib/*.js (benchmark): expose benchmark functionality as a module#44974zombieleet wants to merge 7 commits into
Conversation
|
@nodejs/benchmarking @nodejs/tsc I'm not sure our current benchmark implementation is something that we'd want to expose, but I'm also not sure it isn't. I've always imagined it as kind of ragged and for our own use. But maybe I don't give it enough credit. |
remove benchmark.js from test/common to test/benchmark change import part in all test-benchmark-* file
aduh95
left a comment
There was a problem hiding this comment.
I don't have an opinion whether this should be exposed or not, however in order to land there are a couples of things that need to change on this PR:
- Please remove from
lib/the files whose names starts with an underscore, and move them tolib/internal/benchmarkinstead. - Please make sure that only the new module can only be loaded with the
node:prefix (require('node:benchmark')).require('benchmark')should still refer to userland (e.g.node_modules/benchmark/index.js). To achieve that, add it to that set:node/lib/internal/bootstrap/loaders.js
Lines 124 to 127 in 472edc7
- This needs documentation.
|
I agree with @Trott, the existing benchmarking system is not something we should just dump into a public API. If we decide node core needs to be exposing this sort of functionality, we should instead create something that's designed to be more user/developer-friendly (along with real unit tests) since the existing system was designed more around node's own needs. One of the big issues with doing benchmarking in an environment like this is getting the statistical side right, using javascript. I know there have been attempts at this, but AFAIK using R to do the calculations is still the most reliable way of doing so, so we would need someone familiar enough with R to be able to convert the existing benchmark/*.R scripts safely to JS. I think part of the solution for this would include utilizing |
Exposes the internal benchmark utility module as a core module
I did that in https://github.com/targos/node-benchmark-compare. The JS version gives the exact same numeric results as the R one. The issue isn't really the language (R also uses IEEE 754 floating point numbers), but that we need to be able to compute some statistical distributions. My package ends up using https://github.com/nearform/node-cephes (WASM) |
|
Is there an open issue to discuss the changes stated in this pull request? |
implementation of benchmark/compare.js is now part of lib/benchmark.js
add validaions for http options as well as normal benchmark options add few jsdoc comments
Draft PR to expose the benchmark functionality as part of the core nodejs module.
It's still WIP