-
Notifications
You must be signed in to change notification settings - Fork 29.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
lib: (timers) make arguments array PACKED in all cases #54771
Conversation
Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1631/ Results (no significant perf regression)
|
Can you please amend the commit message so it complies with our guidelines? E.g. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #54771 +/- ##
==========================================
+ Coverage 87.33% 87.60% +0.26%
==========================================
Files 650 650
Lines 182829 182998 +169
Branches 35060 35407 +347
==========================================
+ Hits 159677 160314 +637
+ Misses 16417 15934 -483
- Partials 6735 6750 +15
|
@@ -154,7 +155,7 @@ function setTimeout(callback, after, arg1, arg2, arg3) { | |||
args = [arg1, arg2, arg3]; | |||
for (i = 5; i < arguments.length; i++) { | |||
// Extend array dynamically, makes .apply run much faster in v6.0.0 | |||
args[i - 2] = arguments[i]; | |||
ArrayPrototypePush(args, arguments[i]); |
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.
ArrayPrototypePush(args, arguments[i]); | |
args[args.length] = arguments[i]; |
Out of curiosity, is this faster?
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 suspect they will all be similar
The goal here is to minimize HOLEY internal arrays and not press on objects too much, it might put stress on other parts of V8
PTAL @aduh95 :) |
@aduh95 sorry, completely forgot about the beloved |
PR is currently blocked from landing due to unreliable CI |
It looks good now @jasnell 🚀 |
Commit Queue failed- Loading data for nodejs/node/pull/54771 ✔ Done loading data for nodejs/node/pull/54771 ----------------------------------- PR info ------------------------------------ Title lib: (timers) make arguments array PACKED in all cases (#54771) ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch gurgunday:push -> nodejs:main Labels timers, author ready, needs-ci, needs-benchmark-ci Commits 1 - timers: avoid generating holey internal arrays Committers 1 - Gürgün Dayıoğlu <[email protected]> PR-URL: https://github.com/nodejs/node/pull/54771 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/54771 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> -------------------------------------------------------------------------------- ⚠ Commits were pushed since the last approving review: ⚠ - timers: avoid generating holey internal arrays ℹ This PR was created on Wed, 04 Sep 2024 17:18:00 GMT ✔ Approvals: 2 ✔ - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/54771#pullrequestreview-2283550665 ✔ - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/54771#pullrequestreview-2286915239 ✔ Last GitHub CI successful ℹ Last Benchmark CI on 2024-09-05T08:21:23Z: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1631/ ℹ Last Full PR CI on 2024-09-09T23:02:21Z: https://ci.nodejs.org/job/node-test-pull-request/62212/ - Querying data for job/node-test-pull-request/62212/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/10789630142 |
Not sure what the issue is, @aduh95 😕
My email address is in the commit
Maybe it requires an up-to-date approval before running the commit-queue |
No need to worry about that, it's just a warning
Exactly. Once someone reviews (and approves), they can re-run the |
Landed in 26b03c1 |
PR-URL: #54771 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: #54771 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: #54771 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
When timers have less than 4 arguments, the args array is PACKED, but it's HOLEY when there are more than 4 arguments, I think it might result in performance inconsistencies