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

process: slight refinements to nextTick #17421

Closed

Conversation

apapirovski
Copy link
Member

A couple of very slight refinements to process.nextTick & its supporting code.

  • Remove length prop on NextTickQueue class. We technically don't need to keep track of the length of the queue in two places as we already have tickInfo doing that work (between the index & the length we have enough data for everything).
  • Store asyncId in a const within the _tickCallback function. Accessing symbol properties seems to be quite a bit more expensive than string keys so this actually has a decent performance impact.
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

process

@apapirovski apapirovski added the process Issues and PRs related to the process subsystem. label Dec 2, 2017
@addaleax addaleax added the performance Issues and PRs related to the performance of Node.js. label Dec 2, 2017
@apapirovski
Copy link
Member Author

apapirovski commented Dec 2, 2017

apapirovski added a commit that referenced this pull request Dec 6, 2017
Remove length prop on NextTickQueue class. We technically don't need to
keep track of the length of the queue in two places as we already have
tickInfo doing that work (between the index & the length we have enough
data for everything).

Store asyncId in a const within the _tickCallback function. Accessing
Symbol properties seems to be quite a bit more expensive than string
keys so this actually has a decent performance impact.

PR-URL: #17421
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@apapirovski
Copy link
Member Author

Landed in b1acba3

@apapirovski apapirovski closed this Dec 6, 2017
@apapirovski apapirovski deleted the patch-process-next-tick branch December 6, 2017 18:16
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
Remove length prop on NextTickQueue class. We technically don't need to
keep track of the length of the queue in two places as we already have
tickInfo doing that work (between the index & the length we have enough
data for everything).

Store asyncId in a const within the _tickCallback function. Accessing
Symbol properties seems to be quite a bit more expensive than string
keys so this actually has a decent performance impact.

PR-URL: #17421
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
Remove length prop on NextTickQueue class. We technically don't need to
keep track of the length of the queue in two places as we already have
tickInfo doing that work (between the index & the length we have enough
data for everything).

Store asyncId in a const within the _tickCallback function. Accessing
Symbol properties seems to be quite a bit more expensive than string
keys so this actually has a decent performance impact.

PR-URL: #17421
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Dec 12, 2017
@gibfahn gibfahn added baking-for-lts PRs that need to wait before landing in a LTS release. lts-watch-v6.x labels Dec 20, 2017
@MylesBorins
Copy link
Contributor

Were the perf benefits in this high enough to backport?

@targos targos removed the baking-for-lts PRs that need to wait before landing in a LTS release. label Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Issues and PRs related to the performance of Node.js. process Issues and PRs related to the process subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants