Skip to content

lib: prefer change-by-copy array methods over prior copy - #67473

Open
LiviaMedeiros wants to merge 3 commits into
nodejs:mainfrom
LiviaMedeiros:lib-array-change-by-copy
Open

LiviaMedeiros wants to merge 3 commits into
nodejs:mainfrom
LiviaMedeiros:lib-array-change-by-copy

Conversation

@LiviaMedeiros

Copy link
Copy Markdown
Member

This PR replaces two-pass copy-then-mutate with ES2023 one-pass change-by-copy methods.

The array.slice().push(item) -> array.toSpliced(array.length, 0, item) bit is partially inspired by #67456

Signed-off-by: LiviaMedeiros <livia@cirno.name>
Signed-off-by: LiviaMedeiros <livia@cirno.name>
@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Nov 14, 2026
@codecov

codecov Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.67%. Comparing base (52bfcaf) to head (8b71baa).
⚠️ Report is 23 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67473      +/-   ##
==========================================
- Coverage   90.70%   90.67%   -0.03%     
==========================================
  Files         802      799       -3     
  Lines      282176   280244    -1932     
  Branches    54379    54124     -255     
==========================================
- Hits       255934   254107    -1827     
+ Misses      16365    16270      -95     
+ Partials     9877     9867      -10     
Files with missing lines Coverage Δ
lib/child_process.js 91.54% <100.00%> (-0.01%) ⬇️
lib/domain.js 95.34% <100.00%> (-0.01%) ⬇️
lib/internal/bench_runner/benchmark.js 99.66% <100.00%> (ø)
lib/internal/debugger/inspect_probe.js 83.15% <100.00%> (+0.09%) ⬆️
lib/internal/histogram.js 97.52% <100.00%> (+<0.01%) ⬆️
lib/internal/zip/entry.js 98.60% <100.00%> (-0.01%) ⬇️

... and 70 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.

Comment thread lib/internal/histogram.js Resolved
Signed-off-by: LiviaMedeiros <livia@cirno.name>
@LiviaMedeiros LiviaMedeiros added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Nov 16, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 16, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants