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

lib: make queueMicrotask faster #27032

Closed

Conversation

apapirovski
Copy link
Member

@apapirovski apapirovski commented Mar 31, 2019

  1. async_hooks: improve AsyncResource performance
    Accessing properties behind a symbol is generally quite expensive and so is emitInit, only do both when actually required.

  2. lib: make queueMicrotask faster
    No longer create an additional scope within queueMicrotask in order to improve performance.

CI: https://ci.nodejs.org/job/node-test-pull-request/22078/
Benchmark CI: https://ci.nodejs.org/job/benchmark-node-micro-benchmarks/313/

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Accessing symbols is generally quite expensive and so is emitInit,
only do both when actually required.
No longer create an additional scope within queueMicrotask
in order to improve performance.
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot nodejs-github-bot added async_hooks Issues and PRs related to the async hooks subsystem. process Issues and PRs related to the process subsystem. labels Mar 31, 2019
Copy link
Member

@devsnek devsnek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice 👍

@apapirovski apapirovski changed the title make queueMicrotask faster lib: make queueMicrotask faster Mar 31, 2019
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@refack
Copy link
Contributor

refack commented Mar 31, 2019

Benchmark (job 313) results:

16:03:39                                              confidence improvement accuracy (*)   (**)  (***)
16:03:39  process/queue-microtask-breadth.js n=400000        ***      7.53 %       ±1.34% ±1.76% ±2.27%
16:03:39  process/queue-microtask-depth.js n=1200000                 -0.63 %       ±1.48% ±1.95% ±2.51%

@Trott
Copy link
Member

Trott commented Apr 1, 2019

Don't forget to run test/benchmark/test-benchmark-process.js with these changes.

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 1, 2019
@BridgeAR
Copy link
Member

BridgeAR commented Apr 1, 2019

Don't forget to run test/benchmark/test-benchmark-process.js with these changes.

The test will continue to pass.

@nodejs-github-bot
Copy link
Collaborator

@danbev
Copy link
Contributor

danbev commented Apr 5, 2019

Landed in d3d4e10, and 2c49e8b.

@danbev danbev closed this Apr 5, 2019
danbev pushed a commit that referenced this pull request Apr 5, 2019
Accessing symbols is generally quite expensive and so is emitInit,
only do both when actually required.

PR-URL: #27032
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
danbev pushed a commit that referenced this pull request Apr 5, 2019
No longer create an additional scope within queueMicrotask
in order to improve performance.

PR-URL: #27032
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
async_hooks Issues and PRs related to the async hooks subsystem. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. process Issues and PRs related to the process subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants