-
Notifications
You must be signed in to change notification settings - Fork 30k
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
events: remove code duplication #12655
Conversation
Code duplications are removed from emit* functions. EventEmitter.prototype.emit becomes shorter. The logic of selecting an emit* function is in a separate function now.
Have you benchmarked these changes? The reason they were the way they were was for performance reasons. |
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'm -1 on these changes as is. As @mscdex mentioned, these are there intentionally for performance reasons and should remain. Once we move to enable the TurboFan-Ignition toolchain under V8 5.8 or higher, we will need to revisit this code with an approach that will be optimized for that toolchain.
@gwer Thanks for the PR! To run the benchmarks and check for statistically significant changes, look at the instructions at https://github.com/nodejs/node/blob/master/doc/guides/writing-and-running-benchmarks.md#comparing-nodejs-versions. There's a JS runner ( |
(fyi... I'm running a comparison of this PR to 7.9 and master to 7.9 now... :-) ...) |
This PR compared to 7.9.0 :
Master compared to 7.9.0
Ok, so there are some definite performance regressions that I'm seeing in the event benchmarks independent of this PR, but if we pay attention specifically to the |
@mscdex ... the results of the benchmark run above ^^ are concerning independent of this PR as there are some results there that simply should not be impacted by this change. Can you please take a moment to see what numbers you're getting for the events benchmarks between master and 7.9? |
@jasnell it's very probable that the regression you are seeing comes from #11930, but IMO it is more of a problem of unrealistic benchmark (see #11930 (comment) for my reasoning). |
There was no update here for a long time, so I am going to close this. Please feel free to reopen if you would like to follow up on this! |
Code duplications are removed from emit* functions.
EventEmitter.prototype.emit becomes shorter.
The logic of selecting an emit* function is in a separate function now.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
events