Skip to content

perf_hooks: reduce overhead of createHistogram - #50074

Closed
H4ad wants to merge 5 commits into
nodejs:mainfrom
H4ad:perf/perf_hooks_histogram
Closed

perf_hooks: reduce overhead of createHistogram#50074
H4ad wants to merge 5 commits into
nodejs:mainfrom
H4ad:perf/perf_hooks_histogram

Conversation

@H4ad

@H4adH4ad commented Oct 7, 2023

Copy link
Copy Markdown
Member

Continuing the work started on nodejs/performance#109

 confidence improvement accuracy (*) (**) (***)
perf_hooks/histogram-clone.js n=100000 *** 102.24 % ±1.15% ±1.53% ±2.00%
Be aware that when doing many comparisons the risk of a false-positive
result increases. In this case, there are 1 comparisons, you can thus
expect the following amount of false-positive results:
0.05 false positives, when considering a 5% risk acceptance (*, **, ***),
0.01 false positives, when considering a 1% risk acceptance (**, ***),
0.00 false positives, when considering a 0.1% risk acceptance (***)
 confidence improvement accuracy (*) (**) (***)
perf_hooks/histogram-create.js n=100000 *** 30.19 % ±0.50% ±0.66% ±0.87%
Be aware that when doing many comparisons the risk of a false-positive
result increases. In this case, there are 1 comparisons, you can thus
expect the following amount of false-positive results:
0.05 false positives, when considering a 5% risk acceptance (*, **, ***),
0.01 false positives, when considering a 1% risk acceptance (**, ***),
0.00 false positives, when considering a 0.1% risk acceptance (***)

/cc @nodejs/performance

@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Oct 7, 2023
Comment threadlib/internal/histogram.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This ReflectConstruct can be removed as well

@H4adH4adOct 7, 2023

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Yeah, but since it is not exposed directly I didn't think that was worth it, if not for spec compliance, this code could be removed (I think).

@H4ad
H4adforce-pushed the perf/perf_hooks_histogram branch 2 times, most recently from 76fb187 to d58450aCompareOctober 9, 2023 23:41
@H4ad
H4ad marked this pull request as ready for review October 10, 2023 22:01
@H4ad
H4adforce-pushed the perf/perf_hooks_histogram branch from d58450a to 84d042cCompareOctober 10, 2023 22:01
@H4adH4ad changed the title perf: reduce overhead of createHistogramperf_hooks: reduce overhead of createHistogramOct 10, 2023

@QardQard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, with a minor nit.

Comment threadlib/internal/histogram.js

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@H4ad

H4ad commented Oct 12, 2023

Copy link
Copy Markdown
MemberAuthor

Someone can add author ready?

@QardQard added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 12, 2023
@RafaelGSSRafaelGSS added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 15, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 15, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@H4ad

H4ad commented Oct 18, 2023

Copy link
Copy Markdown
MemberAuthor

I added another commit to try address https://ci.nodejs.org/job/node-test-commit-linux/nodes=ubuntu1804-64/54333/console, I think now both functions are optimized, it is causing an issue with v8 dead code.

Comment threadbenchmark/perf_hooks/histogram.js Outdated
@H4adH4ad added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 19, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 19, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@RafaelGSS

Copy link
Copy Markdown
Member

@H4ad Why this was landed with rebase? It doesn't contain atomic/independent commits that pass the tests according to our contribution guidelines. It also includes a fixup commit to the main queue. Please, use commit-queue-squash for these situations.

@H4ad

H4ad commented Oct 25, 2023

Copy link
Copy Markdown
MemberAuthor

My idea was to ship both commits since I initially thought they should be independent, but thinking more about the reason why I had the commit of test: avoid... was due to the optimization made by the previous commit that caused a test to be flaky, maybe all those commits were better to be landed in just one commit.

But making all the tests pass for each commit that will land in the same PR is something I misread from the guidelines, in case I need to do that, how do I ensure all the tests will pass for previous commits, should I call the job request-ci for each commit?

@RafaelGSS

RafaelGSS commented Oct 25, 2023

Copy link
Copy Markdown
Member

Usually, you guarantee by running the tests on your machine. When you add the commit-queue-rebaseAdd this label to allow the Commit Queue to land a PR in several commits. each the commit shouldn't depend on a subsequent commit otherwise you'll make future git bisect very hard and potential conflicts resolutions when creating the release proposal difficult too - you can check the releases.md how we use git cherry-pick.

Reference: https://github.com/nodejs/node/blob/main/doc/contributing/pull-requests.md#commit-squashing

@aduh95

aduh95 commented Oct 25, 2023

Copy link
Copy Markdown
Contributor

I can confirm that the test suite passes on both commits that landed, so no bisect has been harmed :) The guidelines are vague on what constitutes an atomic commit, so it’s a judgement call to make and both decisions would have been correct: it could have landed as one commit, it could have landed as two commits.
FYI the CQ handles fixup commits fine (i.e. it squashes the fixup commit into the one it targets before pushing to main).

targos pushed a commit that referenced this pull request Nov 11, 2023
PR-URL: #50074
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
targos pushed a commit that referenced this pull request Nov 11, 2023
PR-URL: #50074
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
@targostargos mentioned this pull request Nov 12, 2023
@UlisesGascon

Copy link
Copy Markdown
Member

@H4ad this commit didn’t land cleanly on v20.x-staging. Could you please open a manual backport?

H4ad added a commit to H4ad/node that referenced this pull request Mar 25, 2024
PR-URL: nodejs#50074
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Backport-PR-URL: nodejs#50074
H4ad added a commit to H4ad/node that referenced this pull request Mar 25, 2024
PR-URL: nodejs#50074
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Backport-PR-URL: nodejs#50074
richardlau pushed a commit that referenced this pull request Mar 28, 2024
PR-URL: #50074
Backport-PR-URL: #51306
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
richardlau pushed a commit that referenced this pull request Mar 28, 2024
PR-URL: #50074
Backport-PR-URL: #51306
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
@marco-ippolitomarco-ippolito mentioned this pull request May 2, 2024
firass111 pushed a commit to firass111/Project_node1 that referenced this pull request Apr 16, 2025
PR-URL: nodejs/node#50074
Backport-PR-URL: nodejs/node#51306
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
firass111 pushed a commit to firass111/Project_node1 that referenced this pull request Apr 16, 2025
PR-URL: nodejs/node#50074
Backport-PR-URL: nodejs/node#51306
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.c++Issues and PRs that require attention from people who are familiar with C++.commit-queue-rebaseAdd this label to allow the Commit Queue to land a PR in several commits.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@H4ad@nodejs-github-bot@aduh95@RafaelGSS@UlisesGascon@mcollina@Qard@anonrig@targos