-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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 remaining path benchmarks & optimize #2103
Conversation
Should we maybe force optimize like in https://github.com/nodejs/io.js/blob/master/benchmark/url/url-parse.js#L30? |
That sounds like a good idea to me. |
p.basename('/foo/bar/baz/asdf/quux.html'); | ||
v8.setFlagsFromString('--allow_natives_syntax'); | ||
eval('%OptimizeFunctionOnNextCall(p.basename)'); | ||
p.basename('/foo/bar/baz/asdf/quux.html'); |
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.
Why the call is made in all the cases before benchmark is started?
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 is because it takes V8 extra time to optimize the function when it is called after %OptimizeFunctionOnNextCall
is called on it. So calling the function before the benchmark starts means that the time it takes for V8 to optimize the function does not get recorded as part of the benchmark time.
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.
Nice :-) Did you check if v8 is really going to optimize the function? If the function is never going to be optimized by v8, then we don't have to use this, right?
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.
Even if it doesn't now, that could change in the future, so it might be worth keeping it there anyway.
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.
@mscdex Oh okay then :-)
LGTM |
As a follow-up to 0d15161, this commit adds benchmarks for the rest of the path functions and also forces V8 to optimize the functions before starting the benchmark test.
As a follow-up to 0d15161, this commit adds benchmarks for the rest of the path functions and also forces V8 to optimize the functions before starting the benchmark test. PR-URL: #2103 Reviewed-By: Brendan Ashworth <[email protected]>
landed in 99d9d7e, thanks! |
As a follow-up to 0d15161, this commit adds benchmarks for the rest of the path functions and also forces V8 to optimize the functions before starting the benchmark test (as suggested in a comment by @evanlucas).