-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
v8: refactor the v8 module #12681
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
Closed
Closed
v8: refactor the v8 module #12681
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
const common = require('../common.js'); | ||
const v8 = require('v8'); | ||
|
||
const bench = common.createBenchmark(main, { | ||
method: [ | ||
'getHeapStatistics', | ||
'getHeapSpaceStatistics' | ||
], | ||
n: [1e6], | ||
flags: ['--ignition --turbo', ''] | ||
}); | ||
|
||
function main(conf) { | ||
const n = +conf.n; | ||
const method = conf.method; | ||
var i = 0; | ||
bench.start(); | ||
for (; i < n; i++) | ||
v8[method](); | ||
bench.end(n); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
If I understand the guide right, this should be a property of the third argument (
options
). And flags do not vary, so empty flag seems to be useless. However, I may miss something.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.
Also I am not sure if the
'--ignition --turbo'
should be'--ignition', '--turbo'
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.
Setting the flags like this runs the benchmark with two separate configurations, one with
--ignition --turbo
and the other without flags. I wasn't sure myself but this definitely worked when I ran it like this :-)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.
Are you sure the flags are really set, not only displayed in the config list? I've added a debug log:
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.
Compare:
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 seems this is a design that can be improved. Currently, the key
flags
in configs has no automatic impact, while the same flag in options can not vary between runs.cc @nodejs/performance, @nodejs/benchmarking, @mscdex
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.
I'll just back the flags bit out of this particular change to keep it from holding this up at all, but big +1 on refactoring this generally.
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.
I would actually prefer
flags
in the config object to not have any automagic behavior. It should retain its 'config' meaning (allowing it to be specified on the command line as a regular benchmark option).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.
Yes, I did not propose the automatic behavior for this key in config. I meant that may be an easier way to vary
execArgv
between runs can be supported.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.
Yes, the
flags
in theoptions
is applied to all runs...to compare the performance under different flags I would suggest something likeUnless we have to turn on the flag during bootstrapping..in that case we do need to add special support in the benchmark suite.