-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
lib: remove outdated optimizations #27380
Conversation
@@ -92,9 +92,6 @@ function processTicksAndRejections() { | |||
|
|||
class TickObject { | |||
constructor(callback, args, triggerAsyncId) { | |||
// This must be set to null first to avoid function tracking | |||
// on the hidden class, revisit in V8 versions after 6.2 |
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 these related to https://bugs.chromium.org/p/v8/issues/detail?id=5456 ? @apapirovski
AFAIK constant field tracking is not yet shipped in V8 but the issue is closed so I assume the deopt storm issue has been alleviated by other patches in the upstream.
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 but last I tried this, it was still an issue. We should create a benchmark that actually tests this if we want to be certain. (i recently tried this with timers and still saw perf penalty.)
Benchmark CI for process/next-tick* https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/355/ |
Benchmark CI for timers: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/357/ |
This should not be backported. (I'm not quite sure what labels are necessary for that.) |
@Fishrock123 I just added the necessary labels. v12.x should be fine though. |
The benchmark showed some significant improvement in performance: 01:14:48 confidence improvement accuracy (*) (**) (***)
01:14:48 timers/immediate.js type='breadth1' n=5000000 -2.15 % ±3.43% ±4.57% ±5.95%
01:14:48 timers/immediate.js type='breadth4' n=5000000 1.38 % ±4.12% ±5.48% ±7.14%
01:14:48 timers/immediate.js type='breadth' n=5000000 4.05 % ±4.08% ±5.44% ±7.09%
01:14:48 timers/immediate.js type='clear' n=5000000 *** 24.00 % ±4.58% ±6.12% ±8.01%
01:14:48 timers/immediate.js type='depth1' n=5000000 1.08 % ±1.11% ±1.48% ±1.92%
01:14:48 timers/immediate.js type='depth' n=5000000 0.32 % ±1.60% ±2.13% ±2.77%
01:14:48 timers/set-immediate-breadth-args.js n=5000000 0.34 % ±3.54% ±4.72% ±6.15%
01:14:48 timers/set-immediate-breadth.js n=10000000 -0.78 % ±6.73% ±8.95% ±11.65%
01:14:48 timers/set-immediate-depth-args.js n=5000000 0.42 % ±1.23% ±1.64% ±2.14%
01:14:48 timers/timers-breadth.js n=5000000 -1.77 % ±4.12% ±5.48% ±7.13%
01:14:48 timers/timers-cancel-pooled.js n=5000000 -2.73 % ±10.37% ±13.80% ±17.98%
01:14:48 timers/timers-cancel-unpooled.js direction='end' n=1000000 15.46 % ±25.61% ±34.10% ±44.42%
01:14:48 timers/timers-cancel-unpooled.js direction='start' n=1000000 6.28 % ±9.53% ±12.68% ±16.51%
01:14:48 timers/timers-depth.js n=1000 0.06 % ±0.09% ±0.12% ±0.16%
01:14:48 timers/timers-insert-pooled.js n=5000000 -0.43 % ±3.14% ±4.20% ±5.50%
01:14:48 timers/timers-insert-unpooled.js direction='end' n=1000000 *** 20.17 % ±5.71% ±7.64% ±10.02%
01:14:48 timers/timers-insert-unpooled.js direction='start' n=1000000 2.18 % ±4.79% ±6.37% ±8.29%
01:14:48 timers/timers-timeout-nexttick.js n=50000 3.27 % ±4.56% ±6.07% ±7.91%
01:14:48 timers/timers-timeout-nexttick.js n=5000000 -4.58 % ±5.64% ±7.56% ±9.98%
01:14:48 timers/timers-timeout-pooled.js n=10000000 2.30 % ±5.23% ±6.96% ±9.07%
01:14:48 timers/timers-timeout-unpooled.js n=1000000 0.39 % ±5.18% ±6.89% ±8.97%
|
Those improvements are so large that they seem suspicious. Just to be sure, here's a benchmark comparing master against a PR that does nothing but move some lines in the README.md file. (If it shows a similar difference, then the benchmark results are not valid and there's a problem in the benchmark or the benchmark CI. I don't expect that to be case, but I've seen it once before, so just to be sure... https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/362/) |
Yup. Alarmingly, the benchmark when run with basically the same binary produces erroneous results: 17:25:58 confidence improvement accuracy (*) (**) (***)
17:25:58 timers/immediate.js type='breadth1' n=5000000 -0.18 % ±3.99% ±5.32% ±6.92%
17:25:58 timers/immediate.js type='breadth4' n=5000000 0.93 % ±3.61% ±4.80% ±6.25%
17:25:58 timers/immediate.js type='breadth' n=5000000 1.75 % ±3.76% ±5.01% ±6.53%
17:25:58 timers/immediate.js type='clear' n=5000000 *** 21.68 % ±4.59% ±6.13% ±8.03%
17:25:58 timers/immediate.js type='depth1' n=5000000 -0.65 % ±1.88% ±2.51% ±3.29%
17:25:58 timers/immediate.js type='depth' n=5000000 0.87 % ±1.45% ±1.93% ±2.52%
17:25:58 timers/set-immediate-breadth-args.js n=5000000 -0.53 % ±3.59% ±4.78% ±6.22%
17:25:58 timers/set-immediate-breadth.js n=10000000 -3.25 % ±7.07% ±9.41% ±12.25%
17:25:58 timers/set-immediate-depth-args.js n=5000000 -0.28 % ±1.31% ±1.75% ±2.28%
17:25:58 timers/timers-breadth.js n=5000000 -0.78 % ±4.00% ±5.32% ±6.93%
17:25:58 timers/timers-cancel-pooled.js n=5000000 -2.57 % ±9.54% ±12.69% ±16.52%
17:25:58 timers/timers-cancel-unpooled.js direction='end' n=1000000 13.34 % ±26.15% ±34.86% ±45.51%
17:25:58 timers/timers-cancel-unpooled.js direction='start' n=1000000 2.66 % ±8.58% ±11.42% ±14.88%
17:25:58 timers/timers-depth.js n=1000 -0.04 % ±0.12% ±0.16% ±0.21%
17:25:58 timers/timers-insert-pooled.js n=5000000 0.10 % ±2.70% ±3.60% ±4.70%
17:25:58 timers/timers-insert-unpooled.js direction='end' n=1000000 *** 19.37 % ±4.58% ±6.10% ±7.97%
17:25:58 timers/timers-insert-unpooled.js direction='start' n=1000000 1.52 % ±3.56% ±4.74% ±6.18%
17:25:58 timers/timers-timeout-nexttick.js n=50000 3.89 % ±4.50% ±5.99% ±7.80%
17:25:58 timers/timers-timeout-nexttick.js n=5000000 0.72 % ±1.48% ±1.97% ±2.56%
17:25:58 timers/timers-timeout-pooled.js n=10000000 -1.61 % ±7.30% ±9.72% ±12.66%
17:25:58 timers/timers-timeout-unpooled.js n=1000000 2.95 % ±4.86% ±6.51% ±8.53% So, the benchmark should be run locally because I'm pretty sure this is an issue with the benchmark CI. This is now the second time I have seen this sort of thing. It's disconcerting. |
Landed in 8b04d5c |
PR-URL: #27380 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Benedikt Meurer <[email protected]>
PR-URL: #27380 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Benedikt Meurer <[email protected]>
These two optimizations is outdated in current v8.
Benchmark results:
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes