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: reducing overhead of performance observer entry list #50008

Merged
merged 3 commits into from
Oct 4, 2023

Conversation

H4ad
Copy link
Member

@H4ad H4ad commented Oct 2, 2023

Continuing the work started on nodejs/performance#109.

                                                       confidence improvement accuracy (*)   (**)  (***)
perf_hooks/performance-observer.js pending=1 n=100000         ***    147.63 %       ±3.89% ±5.23% ±6.89%
perf_hooks/performance-observer.js pending=10 n=100000        ***    104.54 %       ±5.69% ±7.60% ±9.92%

Be aware that when doing many comparisons the risk of a false-positive
result increases. In this case, there are 2 comparisons, you can thus
expect the following amount of false-positive results:
  0.10 false positives, when considering a   5% risk acceptance (*, **, ***),
  0.02 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 the needs-ci PRs that need a full CI run. label Oct 2, 2023
lib/internal/perf/observe.js Outdated Show resolved Hide resolved
throw new ERR_ILLEGAL_CONSTRUCTOR();
}

this[kBuffer] = ArrayPrototypeSort(entries, performanceObserverSorter);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if it's a common case or not, but it may/may not be worth guarding the sort with a conditional that checks if entries.length > 1 before sorting.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added, I got 8% faster for 1 item but degraded the else path by ~8%, so I didn't think that was worth it since probably this queue will be called with more items than 1.

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

@nodejs-github-bot
Copy link
Collaborator

@anonrig anonrig added the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 4, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 4, 2023
@nodejs-github-bot nodejs-github-bot merged commit 328bdac into nodejs:main Oct 4, 2023
30 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 328bdac

@H4ad H4ad deleted the perf/perf_hooks_observe branch October 4, 2023 00:42
alexfernandez pushed a commit to alexfernandez/node that referenced this pull request Nov 1, 2023
targos pushed a commit that referenced this pull request Nov 11, 2023
PR-URL: #50008
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
debadree25 pushed a commit to debadree25/node that referenced this pull request Apr 15, 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. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants