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

perf_hooks: reduce overhead of createHistogram #50074

Closed
wants to merge 5 commits into from

Conversation

H4ad
Copy link
Member

@H4ad H4ad commented Oct 7, 2023

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-bot nodejs-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
@@ -318,26 +327,36 @@ class RecordableHistogram extends Histogram {
}
}

function internalHistogram(handle) {
function ClonedHistogram(handle) {
Copy link
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

Copy link
Member Author

@H4ad H4ad Oct 7, 2023

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 H4ad force-pushed the perf/perf_hooks_histogram branch 2 times, most recently from 76fb187 to d58450a Compare October 9, 2023 23:41
@H4ad H4ad marked this pull request as ready for review October 10, 2023 22:01
@H4ad H4ad changed the title perf: reduce overhead of createHistogram perf_hooks: reduce overhead of createHistogram Oct 10, 2023
Copy link
Member

@Qard Qard left a comment

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.

lib/internal/histogram.js Show resolved Hide resolved
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@H4ad
Copy link
Member Author

H4ad commented Oct 12, 2023

Someone can add author ready?

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

@H4ad
Copy link
Member Author

H4ad commented Oct 18, 2023

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.

@H4ad H4ad added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 19, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 19, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot pushed a commit that referenced this pull request Oct 23, 2023
PR-URL: #50074
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
@H4ad H4ad deleted the perf/perf_hooks_histogram branch October 23, 2023 12:41
@RafaelGSS
Copy link
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
Copy link
Member Author

H4ad commented Oct 25, 2023

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
Copy link
Member

RafaelGSS commented Oct 25, 2023

Usually, you guarantee by running the tests on your machine. When you add the commit-queue-rebase Add 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
Copy link
Contributor

aduh95 commented Oct 25, 2023

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).

alexfernandez pushed a commit to alexfernandez/node that referenced this pull request Nov 1, 2023
PR-URL: nodejs#50074
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
alexfernandez pushed a commit to alexfernandez/node that referenced this pull request Nov 1, 2023
PR-URL: nodejs#50074
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
targos pushed a commit that referenced this pull request Nov 11, 2023
PR-URL: #50074
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
targos pushed a commit that referenced this pull request Nov 11, 2023
PR-URL: #50074
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
@UlisesGascon
Copy link
Member

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

@UlisesGascon UlisesGascon added the backport-requested-v20.x PRs awaiting manual backport to the v20.x-staging branch. label Dec 10, 2023
H4ad added a commit to H4ad/node that referenced this pull request Dec 28, 2023
PR-URL: nodejs#50074
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>

Backport-PR-URL: nodejs#50074
H4ad added a commit to H4ad/node that referenced this pull request Dec 28, 2023
PR-URL: nodejs#50074
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>

Backport-PR-URL: nodejs#50074
@H4ad H4ad added backport-open-v20.x Indicate that the PR has an open backport and removed backport-requested-v20.x PRs awaiting manual backport to the v20.x-staging branch. labels Dec 28, 2023
H4ad added a commit to H4ad/node that referenced this pull request Mar 25, 2024
PR-URL: nodejs#50074
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>

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 <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>

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 <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>

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 <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>

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 <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
richardlau pushed a commit that referenced this pull request Mar 28, 2024
PR-URL: #50074
Backport-PR-URL: #51306
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
marco-ippolito pushed a commit that referenced this pull request Apr 29, 2024
PR-URL: #50074
Backport-PR-URL: #51306
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
marco-ippolito pushed a commit that referenced this pull request Apr 29, 2024
PR-URL: #50074
Backport-PR-URL: #51306
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
@targos targos added backported-to-v20.x PRs backported to the v20.x-staging branch. and removed backport-open-v20.x Indicate that the PR has an open backport labels Sep 30, 2024
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. backported-to-v20.x PRs backported to the v20.x-staging branch. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants