Skip to content

Conversation

@aduh95
Copy link
Contributor

Alternative to #54772, as suggested by #54772 (comment)

@aduh95aduh95 added the needs-benchmark-ci PR that need a benchmark CI run. label Oct 1, 2025
@nodejs-github-botnodejs-github-bot added needs-ci PRs that need a full CI run. typings labels Oct 1, 2025
@codecov
Copy link

codecovbot commented Oct 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.45%. Comparing base (b8ea0e8) to head (02feba6).
⚠️ Report is 103 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #60084 +/- ## ========================================== + Coverage 88.43% 88.45% +0.01%  ========================================== Files 703 703 Lines 207795 207819 +24 Branches 40022 40029 +7 ========================================== + Hits 183767 183824 +57 + Misses 16021 15976 -45 - Partials 8007 8019 +12 
Files with missing linesCoverage Δ
lib/internal/per_context/primordials.js99.19% <100.00%> (+0.02%)⬆️
lib/internal/perf/observe.js91.55% <100.00%> (ø)

... and 32 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

*/
primordials.SafeArrayPrototypePushApply=(arr,items)=>{
letstart=0;
letend=start+0x1000;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason not to make this just end = 4096?

letend=start+0x1000;
while(end<items.length){
ArrayPrototypePushApply(arr,ArrayPrototypeSlice(items,start,start=end));
end+=0x1000;
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like the code may be more readable if 4096 was used instead of hex.

@aduh95aduh95 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 12, 2025
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Oct 12, 2025

CI: https://ci.nodejs.org/job/node-test-pull-request/69700/
Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1740/
Benchmark CI: https://github.com/aduh95/node/actions/runs/18449878864

No noticeable perf diff
 confidence improvement accuracy (*) (**) (***) perf_hooks/bench-eventlooputil.js method='ELU_passed' n=1000000 -1.61 % ±2.96% ±3.90% ±5.01% perf_hooks/bench-eventlooputil.js method='ELU_simple' n=1000000 -1.44 % ±2.84% ±3.74% ±4.80% perf_hooks/bench-eventlooputil.js method='idleTime' n=1000000 1.97 % ±3.48% ±4.59% ±5.89% perf_hooks/histogram-clone.js n=100000 -0.33 % ±8.10% ±10.67% ±13.69% perf_hooks/histogram-create.js n=100000 0.50 % ±19.14% ±25.24% ±32.38% perf_hooks/histogram-record.js n=100000 -0.08 % ±6.60% ±8.70% ±11.16% perf_hooks/nodetiming-uvmetricsinfo.js events=1 n=1000000 -0.31 % ±5.33% ±7.03% ±9.02% perf_hooks/nodetiming-uvmetricsinfo.js events=1000 n=1000000 -0.03 % ±5.34% ±7.03% ±9.02% perf_hooks/nodetiming-uvmetricsinfo.js events=10000 n=1000000 0.16 % ±5.36% ±7.07% ±9.07% perf_hooks/now.js n=1000000 0.01 % ±4.58% ±6.04% ±7.74% perf_hooks/performance-observer.js pending=1 n=1000000 0.00 % ±18.62% ±24.54% ±31.49% perf_hooks/performance-observer.js pending=10 n=1000000 -0.01 % ±16.86% ±22.23% ±28.52% perf_hooks/resourcetiming.js observe='resource' n=1000000 0.68 % ±6.88% ±9.07% ±11.64% perf_hooks/time-origin.js method='timeOrigin' n=1000000 0.03 % ±5.16% ±6.81% ±8.74% perf_hooks/time-origin.js method='toJSON' n=1000000 0.53 % ±5.50% ±7.25% ±9.30% perf_hooks/timerfied.js observe='function' n=1000000 -0.06 % ±5.91% ±7.79% ±10.00% perf_hooks/usertiming.js observe='all' n=1000000 0.09 % ±5.87% ±7.74% ±9.93% perf_hooks/usertiming.js observe='measure' n=1000000 -0.51 % ±6.03% ±7.95% ±10.20% Be aware that when doing many comparisons the risk of a false-positive result increases. In this case, there are 18 comparisons, you can thus expect the following amount of false-positive results: 0.90 false positives, when considering a 5% risk acceptance (*, **, ***), 0.18 false positives, when considering a 1% risk acceptance (**, ***), 0.02 false positives, when considering a 0.1% risk acceptance (***) 

@aduh95aduh95 merged commit 822a8c3 into nodejs:mainOct 13, 2025
55 of 56 checks passed
@aduh95
Copy link
ContributorAuthor

Landed in 822a8c3

@aduh95aduh95 deleted the fix-observe-large-arrays branch October 13, 2025 08:05
@aduh95aduh95 mentioned this pull request Oct 13, 2025
@RafaelGSSRafaelGSS mentioned this pull request Oct 13, 2025
9 tasks
targos pushed a commit that referenced this pull request Nov 18, 2025
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.needs-benchmark-ciPR that need a benchmark CI run.needs-ciPRs that need a full CI run.typings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@aduh95@nodejs-github-bot@cjihrig