Skip to content
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: re-use the same isTrusted getter #34459

Closed
wants to merge 1 commit into from

Conversation

addaleax
Copy link
Member

Creating a new function each time the property descriptor is set
comes with performance overhead, since these functions have different
identities, even if they contain the same code.

Refs: https://twitter.com/tverwaes/status/1285496612618473472

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Creating a new function each time the property descriptor is set
comes with performance overhead, since these functions have different
identities, even if they contain the same code.

Refs: https://twitter.com/tverwaes/status/1285496612618473472
@ZYSzys ZYSzys added abandoned author ready PRs that have at least one approval, no pending requests for changes, and a CI started. events Issues and PRs related to the events subsystem / EventEmitter. performance Issues and PRs related to the performance of Node.js. and removed abandoned labels Jul 21, 2020
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Jul 21, 2020

@addaleax addaleax added the fast-track PRs that do not need to wait for 48 hours to land. label Jul 21, 2020
@addaleax
Copy link
Member Author

👍 to fast-track? seems like there is no harm in doing that

@wa-Nadoo
Copy link

Is there any measurable performance benefit due to this change?

@addaleax
Copy link
Member Author

@wa-Nadoo Yes, a bit more than +200 % improvement (i.e. 3× faster than currently):

[00:05:03|% 100| 1/1 files | 60/60 runs | 3/3 configs]: Done
                                               confidence improvement accuracy (*)   (**)  (***)
 events/eventtarget.js listeners=10 n=1000000        ***    214.47 %       ±1.76% ±2.36% ±3.10%
 events/eventtarget.js listeners=1 n=1000000         ***    235.79 %       ±3.13% ±4.21% ±5.57%
 events/eventtarget.js listeners=5 n=1000000         ***    223.85 %       ±2.85% ±3.84% ±5.09%

jasnell pushed a commit that referenced this pull request Jul 21, 2020
Creating a new function each time the property descriptor is set
comes with performance overhead, since these functions have different
identities, even if they contain the same code.

Refs: https://twitter.com/tverwaes/status/1285496612618473472

PR-URL: #34459
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
@jasnell
Copy link
Member

jasnell commented Jul 21, 2020

Landed in 08b6335

@jasnell jasnell closed this Jul 21, 2020
@addaleax addaleax deleted the hoist-isTrusted branch July 21, 2020 23:13
cjihrig pushed a commit that referenced this pull request Jul 23, 2020
Creating a new function each time the property descriptor is set
comes with performance overhead, since these functions have different
identities, even if they contain the same code.

Refs: https://twitter.com/tverwaes/status/1285496612618473472

PR-URL: #34459
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
ruyadorno pushed a commit that referenced this pull request Jul 28, 2020
Creating a new function each time the property descriptor is set
comes with performance overhead, since these functions have different
identities, even if they contain the same code.

Refs: https://twitter.com/tverwaes/status/1285496612618473472

PR-URL: #34459
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
@ruyadorno ruyadorno mentioned this pull request Jul 28, 2020
ruyadorno pushed a commit that referenced this pull request Jul 28, 2020
Creating a new function each time the property descriptor is set
comes with performance overhead, since these functions have different
identities, even if they contain the same code.

Refs: https://twitter.com/tverwaes/status/1285496612618473472

PR-URL: #34459
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
ruyadorno pushed a commit that referenced this pull request Jul 29, 2020
Creating a new function each time the property descriptor is set
comes with performance overhead, since these functions have different
identities, even if they contain the same code.

Refs: https://twitter.com/tverwaes/status/1285496612618473472

PR-URL: #34459
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. events Issues and PRs related to the events subsystem / EventEmitter. fast-track PRs that do not need to wait for 48 hours to land. performance Issues and PRs related to the performance of Node.js.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants