GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — timers: use ref counts to count timers by RaisinTen · Pull Request #41231 · nodejs/node

Conversation

@RaisinTen

@RaisinTen RaisinTen commented Dec 18, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

The additional objects that were getting added and deleted from the
activeTimersMap object were slowing down the rest of the timers code,
so this change falls back to using the ref counts to count the active
timers inside process.getActiveResourcesInfo().

Fixes: #41219

Signed-off-by: Darshan Sen [email protected]

cc @mscdex @nodejs/timers

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@nodejs-github-bot

nodejs-github-bot commented Dec 18, 2021

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/startup
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. timers Issues and PRs related to timers, setImmediate(), setInterval(), and setTimeout(). labels Dec 18, 2021
@RaisinTen RaisinTen mentioned this pull request Dec 18, 2021
timers: recent performance regressions #41219
Closed
@nodejs-github-bot

This comment has been minimized.

Sign in to view
@nodejs-github-bot

This comment has been minimized.

Sign in to view
@RaisinTen

This comment has been minimized.

Sign in to view
@Trott
Trott requested a review from mscdex December 18, 2021 14:19
@nodejs-github-bot

This comment has been minimized.

Sign in to view
mscdex
mscdex reviewed Dec 18, 2021
View reviewed changes
Comment thread lib/internal/bootstrap/node.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

mscdex
mscdex reviewed Dec 18, 2021
View reviewed changes
Comment thread lib/internal/bootstrap/node.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

mscdex
mscdex reviewed Dec 18, 2021
View reviewed changes
Comment thread lib/internal/bootstrap/node.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

mscdex
mscdex reviewed Dec 18, 2021
View reviewed changes
Comment thread lib/internal/bootstrap/node.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

aduh95
aduh95 reviewed Dec 18, 2021
View reviewed changes
Comment thread lib/internal/bootstrap/node.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Dec 19, 2021
CI Reliability 2021-12-19 nodejs/reliability#149
Open
24 tasks
@nodejs-github-bot

This comment has been minimized.

Sign in to view
This was referenced Dec 20, 2021
CI Reliability 2021-12-20 nodejs/reliability#150
Open
CI Reliability 2021-12-21 nodejs/reliability#151
Open
@aduh95

This comment has been minimized.

Sign in to view
This was referenced Dec 22, 2021
CI Reliability 2021-12-22 nodejs/reliability#152
Open
CI Reliability 2021-12-23 nodejs/reliability#153
Open
@RaisinTen RaisinTen mentioned this pull request Dec 23, 2021
Revert "process: add getActiveResourcesInfo()" #41298
Closed
@RaisinTen

RaisinTen commented Dec 23, 2021

Copy link
Copy Markdown
Member Author

The benchmark results look very similar to the results of the revert PR - #41298. I think we should go ahead with this change because the slowdown in timers/timers-breadth-args.js and timers/timers-insert-pooled.js is present in the revert PR too.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

This comment has been minimized.

Sign in to view
@github-actions github-actions Bot mentioned this pull request Dec 24, 2021
CI Reliability 2021-12-24 nodejs/reliability#154
Open
18 tasks
apapirovski
apapirovski suggested changes Dec 29, 2021
View reviewed changes

@apapirovski apapirovski left a comment

Copy link
Copy Markdown
Contributor

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 left some comments but honestly they're all superfluous because this and the original PR are both doing entirely too much work. Both Timer & Immediate already do their own book-keeping in JS-land for the number of active objects. You just need to export a function that returns refCount & immediateInfo[kRefCount] from internal/timers.js.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread lib/internal/bootstrap/node.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/internal/bootstrap/node.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/internal/bootstrap/node.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/internal/bootstrap/node.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@RaisinTen
timers: use ref counts to count timers
4446606
The additional objects that were getting added and deleted from the
activeTimersMap object were slowing down the rest of the timers code,
so this change falls back to using the ref counts to count the active
timers inside process.getActiveResourcesInfo().

Fixes: nodejs#41219

Signed-off-by: Darshan Sen <[email protected]>
@RaisinTen
RaisinTen force-pushed the timers/use-timerListMap-and-outstandingQueue-to-count-timers branch from 157ced8 to 4446606 Compare December 31, 2021 09:41
@RaisinTen RaisinTen changed the title timers: use timerListMap and outstandingQueue to count timers timers: use ref counts to count timers Dec 31, 2021
@RaisinTen

RaisinTen commented Dec 31, 2021

Copy link
Copy Markdown
Member Author

@apapirovski thanks for the review! I've updated the PR to use refCount and immediateInfo[kRefCount] to count the timers, PTAL.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@RaisinTen
RaisinTen requested a review from apapirovski December 31, 2021 09:44
@nodejs-github-bot

This comment has been minimized.

Sign in to view
@RaisinTen

RaisinTen commented Dec 31, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Timers benchmark CI: https://ci.nodejs.org/job/benchmark-node-micro-benchmarks/1080/

                                                             confidence improvement accuracy (*)    (**)   (***)
timers/immediate.js type='breadth1' n=5000000                               -1.17 %       ±4.24%  ±5.65%  ±7.38%
timers/immediate.js type='breadth4' n=5000000                        **      6.94 %       ±4.99%  ±6.67%  ±8.76%
timers/immediate.js type='breadth' n=5000000                        ***     19.86 %       ±5.15%  ±6.88%  ±8.98%
timers/immediate.js type='clear' n=5000000                          ***    282.93 %       ±4.54%  ±6.11%  ±8.11%
timers/immediate.js type='depth1' n=5000000                         ***     41.79 %       ±1.93%  ±2.58%  ±3.38%
timers/immediate.js type='depth' n=5000000                          ***     41.20 %       ±1.26%  ±1.67%  ±2.17%
timers/set-immediate-breadth-args.js n=5000000                              -0.07 %       ±4.01%  ±5.35%  ±6.99%
timers/set-immediate-breadth.js n=10000000                                  -1.82 %       ±3.54%  ±4.71%  ±6.15%
timers/set-immediate-depth-args.js n=5000000                        ***     39.03 %       ±2.49%  ±3.31%  ±4.31%
timers/timers-breadth-args.js n=1000000                             ***    -12.75 %       ±5.98%  ±8.00% ±10.51%
timers/timers-breadth.js n=5000000                                           2.47 %       ±3.74%  ±4.98%  ±6.50%
timers/timers-cancel-pooled.js n=5000000                            ***    188.38 %      ±24.54% ±32.95% ±43.50%
timers/timers-cancel-unpooled.js direction='end' n=1000000           **     24.24 %      ±15.35% ±20.48% ±26.75%
timers/timers-cancel-unpooled.js direction='start' n=1000000          *      9.86 %       ±8.87% ±11.81% ±15.39%
timers/timers-depth.js n=1000                                               -0.24 %       ±0.47%  ±0.63%  ±0.82%
timers/timers-insert-pooled.js n=5000000                            ***    -17.76 %       ±3.28%  ±4.36%  ±5.68%
timers/timers-insert-unpooled.js direction='end' n=1000000          ***     11.50 %       ±4.24%  ±5.65%  ±7.36%
timers/timers-insert-unpooled.js direction='start' n=1000000        ***     10.90 %       ±3.99%  ±5.31%  ±6.91%
timers/timers-timeout-nexttick.js n=50000                           ***     18.12 %       ±6.26%  ±8.35% ±10.93%
timers/timers-timeout-nexttick.js n=5000000                         ***     70.62 %       ±8.74% ±11.63% ±15.16%
timers/timers-timeout-pooled.js n=10000000                          ***     93.09 %      ±11.97% ±16.06% ±21.16%
timers/timers-timeout-unpooled.js n=1000000                         ***     88.09 %      ±14.55% ±19.37% ±25.22%
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Dec 31, 2021

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/41707/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

apapirovski
apapirovski approved these changes Dec 31, 2021
View reviewed changes

@apapirovski apapirovski left a comment

Copy link
Copy Markdown
Contributor

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.

Looks good. Thanks for making the change!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot mentioned this pull request Jan 1, 2022
CI Reliability 2022-01-01 nodejs/reliability#162
Open
24 tasks
@RaisinTen RaisinTen added author ready PRs with CI started, the required approvals, and no outstanding review comments. and removed needs-ci PRs that need a full CI run. labels Jan 1, 2022
aduh95
aduh95 approved these changes Jan 1, 2022
View reviewed changes

@aduh95 aduh95 left a comment

Copy link
Copy Markdown
Contributor

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.

Benchmark results look impressive 👏

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot mentioned this pull request Jan 2, 2022
CI Reliability 2022-01-02 nodejs/reliability#163
Open
23 tasks
@RaisinTen RaisinTen added the commit-queue PRs queued for automated landing through the Commit Queue. label Jan 2, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Jan 2, 2022
@nodejs-github-bot
nodejs-github-bot merged commit 64cc066 into nodejs:master Jan 2, 2022
@nodejs-github-bot

nodejs-github-bot commented Jan 2, 2022

Copy link
Copy Markdown
Collaborator

Landed in 64cc066

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@RaisinTen
RaisinTen deleted the timers/use-timerListMap-and-outstandingQueue-to-count-timers branch January 2, 2022 15:28
This was referenced Jan 3, 2022
CI Reliability 2022-01-03 nodejs/reliability#164
Open
CI Reliability 2022-01-04 nodejs/reliability#165
Open
CI Reliability 2022-01-05 nodejs/reliability#166
Open
CI Reliability 2022-01-06 nodejs/reliability#167
Open
CI Reliability 2022-01-07 nodejs/reliability#168
Open
CI Reliability 2022-01-08 nodejs/reliability#169
Open
CI Reliability 2022-01-09 nodejs/reliability#170
Open
targos pushed a commit that referenced this pull request Jan 14, 2022
@RaisinTen @targos
timers: use ref counts to count timers
2e92f6f
The additional objects that were getting added and deleted from the
activeTimersMap object were slowing down the rest of the timers code,
so this change falls back to using the ref counts to count the active
timers inside process.getActiveResourcesInfo().

Fixes: #41219

Signed-off-by: Darshan Sen <[email protected]>

PR-URL: #41231
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@targos targos mentioned this pull request Jan 16, 2022
v17.4.0 release proposal #41557
Merged
danielleadams pushed a commit that referenced this pull request Jan 31, 2022
@RaisinTen @danielleadams
timers: use ref counts to count timers
d2db729
The additional objects that were getting added and deleted from the
activeTimersMap object were slowing down the rest of the timers code,
so this change falls back to using the ref counts to count the active
timers inside process.getActiveResourcesInfo().

Fixes: #41219

Signed-off-by: Darshan Sen <[email protected]>

PR-URL: #41231
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
danielleadams pushed a commit that referenced this pull request Feb 1, 2022
@RaisinTen @danielleadams
timers: use ref counts to count timers
b5b3750
The additional objects that were getting added and deleted from the
activeTimersMap object were slowing down the rest of the timers code,
so this change falls back to using the ref counts to count the active
timers inside process.getActiveResourcesInfo().

Fixes: #41219

Signed-off-by: Darshan Sen <[email protected]>

PR-URL: #41231
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@danielleadams danielleadams mentioned this pull request Feb 1, 2022
v16.14.0 proposal #41804
Merged
@fb55 fb55 mentioned this pull request Apr 22, 2022
Update parse5 to 7.0.0 jsdom/jsdom#3354
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@aduh95 aduh95 aduh95 approved these changes
+2 more reviewers
@mscdex mscdex mscdex left review comments
@apapirovski apapirovski apapirovski approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. timers Issues and PRs related to timers, setImmediate(), setInterval(), and setTimeout().

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

timers: recent performance regressions

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@RaisinTen @nodejs-github-bot @aduh95 @apapirovski @mscdex
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.