-
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: remove %OptimizeFunctionOnNextCall #9615
Conversation
/cc @mscdex since he's done a lot of performance work too |
I think this should only be removed for functions that are potentially inlineable due to their function size. |
@mscdex For most of the benchmarks except ones mentioned in PR removing the Could you also elaborate on those inlineable functions? |
bd2fd0b
to
5e1d6ba
Compare
Rebased on master, PTAL |
@mscdex ... any further thoughts on this? |
As far as inlineability I would just check the current function lengths (there are other factors that determine inlineability of course). If the function being tested is less than 600, remove the forced optimization, otherwise leave it there. |
Most of the time If we remove it, it will make some of the benchmark perform better. Furthermore, this will make benchmarks engine agnostic, so they can be used with chakracore (see nodejs/node-chakracore#134) |
I'm pretty sure that inlineability does not depend on function length any more but bytecode size (at least in the near future). |
I'm in favor of making the benchmarks vm agnostic. I don't see the point in measuring only the optimized runs instead of all the runs. |
As of 5.7.201 (and is the same on a6976211d1a4d12df815fa9ff5341dcbcf1e8036, latest master) https://github.com/v8/v8/blob/5.7.201/src/flag-definitions.h#L329-L330 |
The idea is to remove variability in the benchmarks to better compare between versions. Ideally we could run the benchmarks fully optimized and run them not allowing to optimize the code at all. |
@trevnorris So, are you in favor of this change? Or maybe you have other suggestions? |
5e1d6ba
to
371ff17
Compare
Rebased, PTAL |
371ff17
to
c1a6689
Compare
Rebased again, PTAL |
c1a6689
to
d9f44c7
Compare
/cc @nodejs/collaborators |
@mscdex ... Side note: I've been wondering if it would be worthwhile to introduce linting for functions that are over the inlinable size. Sure, there are quite a few instances of fns in core over that size, and I'm not suggesting that we should refactor those, just that they should require linting exceptions. |
@trevnorris ... I've had a todo on my list for a while to see if there was some way that we can build in checking optimized and non-optimized run's for all benchmarks. I definitely think it would be worthwhile. Likewise, we should likely be making it easier to run the benchmarks in a way that compares use of the ignition toolchain vs. crankshaft. |
@jasnell Won’t that go away with Turbofan anyway (v8/v8@0702ea3)? |
Yes, sorry, I wasn't clear... it would be useful to be able to more easily run (if this already exists and I just missed it, then just ignore me ;-) ...) |
Refocusing the conversation: I imagine @bzoz wants to know if anyone feels good enough about this to give it an approval or else to describe clearly what changes would need to happen to get your approval. Anyone? |
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.
While I'm generally ok with the idea of removing the forced optimization, I'd rather it be done more incrementally than this... with either one benchmark or one related group of benchmarks edited per commit.
This isn't landing cleanly on v7.x-staging. Mind submitting a backport PR? |
Removes all instances of %OptimizeFunctionOnNextCall from benchmarks Refs: nodejs#9615 Refs: nodejs#11720
@evanlucas backport here: #11744 |
Removes all instances of %OptimizeFunctionOnNextCall from benchmarks Refs: nodejs#9615 Refs: nodejs#11720
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
benchmark
Description of change
This removes all instances of
%OptimizeFunctionOnNextCall
from Node.js benchmarks. As it turns out, most bechmark benefit from its removal - they will perform better. See this table in gist.Some of the benchmarks (
buffers/buffer-swap.js
,crypto/get-chiper.js
,net/punnycode.js
,path/parse-*.js
,path/relative-*.js
andtls/convertprotocols.js
) benefit from warmup phase. Those are executed twice with only second run being measured. For other benchmarks warmup does not provide any advantage.One benchmark that is slower is
crypto/get-chiper.js
, when callinggetCiphers
once. Previous version called this function once to trigger optimizations then to benchmark its performance. Results of that function are cached, so it didn’t provide valid data. This is fixed now.Fixes: nodejs/node-chakracore#134
cc @nodejs/benchmarking