-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
benchmark: add --expose_internals switch #8547
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Nit: |
@@ -36,7 +36,8 @@ if (format === 'csv') { | |||
|
|||
(function recursive(i) { | |||
const filename = benchmarks[i]; | |||
const child = fork(path.resolve(__dirname, filename), cli.optional.set); | |||
const child = fork(path.resolve(__dirname, filename), cli.optional.set, | |||
{ execArgv: ['--expose_internals'] }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should extend process.execArgv
not overwrite it. Otherwise profiling/debugging flags etc. won't work.
I think you should add this to |
@@ -36,7 +36,8 @@ if (format === 'csv') { | |||
|
|||
(function recursive(i) { | |||
const filename = benchmarks[i]; | |||
const child = fork(path.resolve(__dirname, filename), cli.optional.set); | |||
const child = fork(path.resolve(__dirname, filename), cli.optional.set, | |||
{ execArgv: ['--expose_internals'] }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this mean it will be passed regardless? DO we need the // Flags:
comment since it doesn't work anyways?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need it, but it will be helpful for someone who tries to run this one benchmark
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
common.js
ensures that benchmarks are always forked, so there is no way to execute a single benchmark without --expose_internals
being automatically applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is for people that try node benchmark\misc\freelist.js
and encounter problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you think it would be better to move the require('internal/freelist')
inside main, instead of having all these --expose_internals
around?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats a great idea!
Updated, PTAL Unfortunately, we need to add this everywhere - in |
Please elaborate on why you can't just add it here: https://github.com/nodejs/node/blob/master/benchmark/common.js#L139L141 |
When |
Adds --expose_internals switch to benchmark runner. This makes misc/freelist.js benchmark run properly
6cd4a0d
to
167b1e6
Compare
Updated again. @AndreasMadsen you had great idea. Moved the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
var bench = common.createBenchmark(main, { | ||
n: [100000] | ||
}); | ||
|
||
function main(conf) { | ||
const FreeList = require('internal/freelist').FreeList; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's up with this? Maybe add a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require
was moved there, so it will work with adding -expose_internals
only in common.js
. It was the result of discusion here: #8547 (review)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM!
Updated, PTAL |
If there are no further objections I would like to land this tomorrow. |
Adds --expose_internals switch to benchmark runner. This makes misc/freelist.js benchmark run properly Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com> PR-URL: #8547
Landed in 99a2dd0. @AndreasMadsen - again, thanks for great input. |
Awesome work 👍 |
Adds --expose_internals switch to benchmark runner. This makes misc/freelist.js benchmark run properly Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com> PR-URL: #8547
Adds --expose_internals switch to benchmark runner. This makes misc/freelist.js benchmark run properly Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com> PR-URL: nodejs#8547
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
benchmark
Description of change
Adds
--expose_insternals
switch to benchmark runner. This makesmisc/freelist.js
and any other benchmark requiring access to internal modules run properly on Windows.cc @nodejs/benchmarking