Skip to content

util: use indexed writes in Set and Map inspection - #67295

Open
rozzilla wants to merge 1 commit into
nodejs:mainfrom
rozzilla:perf-util-inspect-set-map
Open

rozzilla wants to merge 1 commit into
nodejs:mainfrom
rozzilla:perf-util-inspect-set-map

Conversation

@rozzilla

@rozzilla rozzilla commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Avoid the cost of primordial push calls for each formatted entry by using indexed writes to collect formatted Set and Map entries. Similar approach as for this PR: #66872

In local 30-sample benchmarks, inspecting 50-element collections improved
throughput by 15.9% for Sets and 8.7% for Maps. Reverse comparisons
confirmed both gains, with no corrected-significant regressions in the
broader comparison.

Avoid the cost of primordial push calls for each formatted entry.

Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/performance

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. labels Nov 6, 2026
@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.67%. Comparing base (fca40eb) to head (a38c1c3).
⚠️ Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67295      +/-   ##
==========================================
- Coverage   93.00%   90.67%   -2.33%     
==========================================
  Files         428      797     +369     
  Lines      195754   279605   +83851     
  Branches    30290    53789   +23499     
==========================================
+ Hits       182054   253532   +71478     
- Misses      13374    16353    +2979     
- Partials      326     9720    +9394     
Files with missing lines Coverage Δ
lib/internal/util/inspect.js 97.04% <100.00%> (+20.97%) ⬆️

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

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

Labels

needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants