Skip to content

url: use indexed appends in search params getAll - #66872

Open
rozzilla wants to merge 1 commit into
nodejs:mainfrom
rozzilla:url-optimize-searchparams-getall
Open

rozzilla wants to merge 1 commit into
nodejs:mainfrom
rozzilla:url-optimize-searchparams-getall

Conversation

@rozzilla

Copy link
Copy Markdown
Contributor

Use indexed appends instead of primordial push calls when collecting
matching values in URLSearchParams.getAll(). This reduces the cost of
reading repeated query parameters while preserving result order.

Local benchmarks on Apple M2/macOS with V8 15.6 show higher throughput:

  • Existing two- and three-match workloads: +20.4% and +29.4%.
  • Consumed-result reads with multiple matches: +28.5–106.8%.
  • Parsing a fresh query and retrieving 256 matching values: +8.9%.

Across 36 cases and 4,320 samples, nine gains were confirmed in both
comparison directions after Holm correction. No corrected-significant
regressions were detected.

Use indexed writes when collecting matching parameter values.
This improves getAll throughput without changing result order.

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

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/performance
  • @nodejs/url

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. whatwg-url Issues and PRs related to the WHATWG URL implementation. labels Oct 20, 2026
@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.49%. Comparing base (531d28f) to head (74a74c7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66872      +/-   ##
==========================================
- Coverage   90.49%   90.49%   -0.01%     
==========================================
  Files         797      797              
  Lines      278221   278221              
  Branches    53462    53458       -4     
==========================================
- Hits       251786   251774      -12     
- Misses      16809    16823      +14     
+ Partials     9626     9624       -2     
Files with missing lines Coverage Δ
lib/internal/url.js 93.40% <100.00%> (ø)

... and 27 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. whatwg-url Issues and PRs related to the WHATWG URL implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants