events: inline hybrid dispatch closures - #64473
Closed
slagiewka wants to merge 2 commits into
Closed
Conversation
Contributor
Author
|
Looks like the convention for commit scope here is either |
Originally added in 16b11cd, it first had three callers. Now there's only one branch requireing it. Signed-off-by: Szymon Łągiewka <slagiewka@users.noreply.github.com>
While more readable, the removed closure overhead unlocks 10-20% in eventtarget.js benchmark. Signed-off-by: Szymon Łągiewka <slagiewka@users.noreply.github.com>
Member
|
@nodejs/events |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #64473 +/- ##
==========================================
+ Coverage 90.21% 90.24% +0.03%
==========================================
Files 741 741
Lines 241608 241680 +72
Branches 45534 45542 +8
==========================================
+ Hits 217972 218110 +138
+ Misses 15154 15112 -42
+ Partials 8482 8458 -24
🚀 New features to boost your workflow:
|
Contributor
Author
|
@nodejs/events |
atlowChemi
approved these changes
Aug 23, 2026
atlowChemi
left a comment
Member
There was a problem hiding this comment.
Assuming benchmarks support this
Member
This comment was marked as outdated.
This comment was marked as outdated.
Collaborator
Member
Output from Benchmarking CI confidence improvement accuracy (*) (**) (***)
events/ee-add-remove.js n=1000000 removeListener=0 newListener=0 -0.63 % ±1.28% ±1.70% ±2.22%
events/ee-add-remove.js n=1000000 removeListener=0 newListener=1 -0.28 % ±1.11% ±1.48% ±1.93%
events/ee-add-remove.js n=1000000 removeListener=1 newListener=0 -1.02 % ±1.04% ±1.38% ±1.80%
events/ee-add-remove.js n=1000000 removeListener=1 newListener=1 -0.15 % ±1.10% ±1.47% ±1.91%
events/ee-emit.js listeners=1 argc=0 n=2000000 ** 4.95 % ±3.70% ±4.94% ±6.45%
events/ee-emit.js listeners=1 argc=10 n=2000000 ** 9.13 % ±5.51% ±7.33% ±9.55%
events/ee-emit.js listeners=1 argc=2 n=2000000 4.57 % ±5.80% ±7.72% ±10.04%
events/ee-emit.js listeners=1 argc=4 n=2000000 *** 10.33 % ±5.72% ±7.62% ±9.94%
events/ee-emit.js listeners=10 argc=0 n=2000000 0.25 % ±1.13% ±1.50% ±1.96%
events/ee-emit.js listeners=10 argc=10 n=2000000 ** 3.40 % ±2.22% ±2.97% ±3.90%
events/ee-emit.js listeners=10 argc=2 n=2000000 -0.42 % ±1.49% ±1.98% ±2.57%
events/ee-emit.js listeners=10 argc=4 n=2000000 1.19 % ±1.56% ±2.08% ±2.71%
events/ee-emit.js listeners=5 argc=0 n=2000000 -0.40 % ±2.02% ±2.68% ±3.49%
events/ee-emit.js listeners=5 argc=10 n=2000000 ** 4.01 % ±2.52% ±3.36% ±4.38%
events/ee-emit.js listeners=5 argc=2 n=2000000 ** 3.27 % ±2.31% ±3.08% ±4.02%
events/ee-emit.js listeners=5 argc=4 n=2000000 *** 4.70 % ±2.29% ±3.05% ±3.98%
events/ee-listen-unique.js n=1000000 events=1 0.61 % ±1.23% ±1.64% ±2.14%
events/ee-listen-unique.js n=1000000 events=10 0.53 % ±1.61% ±2.14% ±2.78%
events/ee-listen-unique.js n=1000000 events=2 -0.55 % ±1.31% ±1.74% ±2.27%
events/ee-listen-unique.js n=1000000 events=20 -0.51 % ±1.70% ±2.26% ±2.95%
events/ee-listen-unique.js n=1000000 events=3 0.39 % ±1.48% ±1.97% ±2.57%
events/ee-listen-unique.js n=1000000 events=5 0.22 % ±1.26% ±1.68% ±2.19%
events/ee-listener-count-on-prototype.js n=50000000 -0.95 % ±1.76% ±2.34% ±3.04%
events/ee-listeners.js raw='false' listeners=5 n=5000000 1.05 % ±1.28% ±1.70% ±2.22%
events/ee-listeners.js raw='false' listeners=50 n=5000000 -0.32 % ±0.52% ±0.69% ±0.90%
events/ee-listeners.js raw='true' listeners=5 n=5000000 2.06 % ±2.25% ±3.00% ±3.93%
events/ee-listeners.js raw='true' listeners=50 n=5000000 0.19 % ±0.64% ±0.86% ±1.11%
events/ee-once.js argc=0 n=20000000 -0.55 % ±1.37% ±1.82% ±2.37%
events/ee-once.js argc=1 n=20000000 0.71 % ±1.74% ±2.31% ±3.01%
events/ee-once.js argc=4 n=20000000 -0.24 % ±1.77% ±2.36% ±3.07%
events/ee-once.js argc=5 n=20000000 0.13 % ±1.31% ±1.75% ±2.28%
events/eventtarget-add-remove-abort.js nListener=1 n=100000 1.87 % ±2.39% ±3.19% ±4.15%
events/eventtarget-add-remove-abort.js nListener=10 n=100000 0.71 % ±1.48% ±1.97% ±2.57%
events/eventtarget-add-remove-abort.js nListener=5 n=100000 0.59 % ±2.28% ±3.03% ±3.94%
events/eventtarget-add-remove.js nListener=1 n=100000 -1.62 % ±2.94% ±3.91% ±5.11%
events/eventtarget-add-remove.js nListener=10 n=100000 -0.48 % ±1.22% ±1.63% ±2.12%
events/eventtarget-add-remove.js nListener=5 n=100000 0.67 % ±2.07% ±2.75% ±3.58%
events/eventtarget-creation.js n=1000000 2.08 % ±4.94% ±6.60% ±8.65%
events/eventtarget.js listeners=1 n=1000000 *** 19.23 % ±1.94% ±2.58% ±3.36%
events/eventtarget.js listeners=10 n=1000000 *** 13.47 % ±1.09% ±1.46% ±1.90%
events/eventtarget.js listeners=5 n=1000000 *** 14.48 % ±1.08% ±1.44% ±1.88% |
Member
|
@atlowChemi Looks like this is ready to merge. |
Collaborator
|
Landed in e618b1b...984e46f |
nodejs-github-bot
pushed a commit
that referenced
this pull request
Aug 25, 2026
While more readable, the removed closure overhead unlocks 10-20% in eventtarget.js benchmark. Signed-off-by: Szymon Łągiewka <slagiewka@users.noreply.github.com> PR-URL: #64473 Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
aduh95
pushed a commit
that referenced
this pull request
Aug 25, 2026
While more readable, the removed closure overhead unlocks 10-20% in eventtarget.js benchmark. Signed-off-by: Szymon Łągiewka <slagiewka@users.noreply.github.com> PR-URL: #64473 Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
aduh95
pushed a commit
that referenced
this pull request
Aug 25, 2026
While more readable, the removed closure overhead unlocks 10-20% in eventtarget.js benchmark. Signed-off-by: Szymon Łągiewka <slagiewka@users.noreply.github.com> PR-URL: #64473 Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
lib: inline createEvent hybrid dispatch closure
Originally added in 16b11cd, it first
had three callers. Now there's only one branch requireing it.
lib: inline iterationCondition hybrid dispatch closure
While more readable, the removed closure overhead unlocks 10-20% in
eventtarget.js benchmark (30 runs).