8000 url: remove array.reduce usage to make inspect faster by gurgunday · Pull Request #60748 · nodejs/node · GitHub < 8000 meta name="visitor-hmac" content="627cdfff2f837e49c5eac00cc9d9847517b13d0f7b43b46a017174e6e2498163" data-pjax-transient="true"/>
[go: up one dir, main page]

Skip to content

url: remove array.reduce usage to make inspect faster#60748

Merged
nodejs-github-bot merged 2 commits intonodejs:mainfrom
gurgunday:remove-reduce-url
Nov 23, 2025
Merged

url: remove array.reduce usage to make inspect faster#60748
nodejs-github-bot merged 2 commits intonodejs:mainfrom
gurgunday:remove-reduce-url

Conversation

@gurgunday
Copy link
Member

branch:

url/url-searchparams-inspect.js
url/url-searchparams-inspect.js n=100000 kind="params" variant="empty": 4,532,381.098194127
url/url-searchparams-inspect.js n=100000 kind="iterator-keys" variant="empty": 1,515,353.3785894632
url/url-searchparams-inspect.js n=100000 kind="iterator-values" variant="empty": 1,492,998.7614679476
url/url-searchparams-inspect.js n=100000 kind="iterator-entries" variant="empty": 1,450,254.4522195323
url/url-searchparams-inspect.js n=100000 kind="params" variant="small": 403,675.9409357187
url/url-searchparams-inspect.js n=100000 kind="iterator-keys" variant="small": 427,352.2536421096
url/url-searchparams-inspect.js n=100000 kind="iterator-values" variant="small": 420,388.7130120308
url/url-searchparams-inspect.js n=100000 kind="iterator-entries" variant="small": 207,149.16684729385
url/url-searchparams-inspect.js n=100000 kind="params" variant="medium": 78,324.92739345282
url/url-searchparams-inspect.js n=100000 kind="iterator-keys" variant="medium": 103,255.19317270137
url/url-searchparams-inspect.js n=100000 kind="iterator-values" variant="medium": 105,868.77834677565
url/url-searchparams-inspect.js n=100000 kind="iterator-entries" variant="medium": 42,676.903041653466
url/url-searchparams-inspect.js n=100000 kind="params" variant="large": 10,407.476332765786
url/url-searchparams-inspect.js n=100000 kind="iterator-keys" variant="large": 15,924.216229468899
url/url-searchparams-inspect.js n=100000 kind="iterator-values" variant="large": 15,842.239285517238
url/url-searchparams-inspect.js n=100000 kind="iterator-entries" variant="large": 6,287.244407894947

main:

url/url-searchparams-inspect.js
url/url-searchparams-inspect.js n=100000 kind="params" variant="empty": 4,141,001.0870127855
url/url-searchparams-inspect.js n=100000 kind="iterator-keys" variant="empty": 1,456,942.7876779065
url/url-searchparams-inspect.js n=100000 kind="iterator-values" variant="empty": 975,149.1432105592
url/url-searchparams-inspect.js n=100000 kind="iterator-entries" variant="empty": 1,385,660.492394456
url/url-searchparams-inspect.js n=100000 kind="params" variant="small": 382,729.5216981326
url/url-searchparams-inspect.js n=100000 kind="iterator-keys" variant="small": 402,301.29698277207
url/url-searchparams-inspect.js n=100000 kind="iterator-values" variant="small": 403,590.5432681854
url/url-searchparams-inspect.js n=100000 kind="iterator-entries" variant="small": 197,061.3393303881
url/url-searchparams-inspect.js n=100000 kind="params" variant="medium": 78,651.96299050128
url/url-searchparams-inspect.js n=100000 kind="iterator-keys" variant="medium": 101,996.0845906241
url/url-searchparams-inspect.js n=100000 kind="iterator-values" variant="medium": 101,739.53835371115
url/url-searchparams-inspect.js n=100000 kind="iterator-entries" variant="medium": 41,671.14631489552
url/url-searchparams-inspect.js n=100000 kind="params" variant="large": 9,892.61944926823
url/url-searchparams-inspect.js n=100000 kind="iterator-keys" variant="large": 15,148.689404508617
url/url-searchparams-inspect.js n=100000 kind="iterator-values" variant="large": 15,377.710695515232
url/url-searchparams-inspect.js n=100000 kind="iterator-entries" variant="large": 5,952.288479327792

Reduce is slow, we should prefer iteration

@nodejs-github-bot
Copy link
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 Nov 16, 2025
@gurgunday gurgunday added the performance Issues and PRs related to the performance of Node.js. label Nov 16, 2025
@codecov
Copy link
codecov bot commented Nov 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.56%. Comparing base (2856475) to head (7e3b871).
⚠️ Report is 65 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #60748      +/-   ##
==========================================
+ Coverage   88.54%   88.56%   +0.02%     
==========================================
  Files         703      703              
  Lines      208222   208243      +21     
  Branches    40140    40155      +15     
==========================================
+ Hits       184360   184423      +63     
+ Misses      15882    15822      -60     
- Partials     7980     7998      +18     
Files with missing lines Coverage Δ
lib/internal/url.js 94.07% <100.00%> (+0.72%) ⬆️

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

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@aduh95 aduh95 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 Nov 23, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 23, 2025
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Nov 23, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 23, 2025
@nodejs-github-bot nodejs-github-bot merged commit 7fe8085 into nodejs:main Nov 23, 2025
74 of 75 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 7fe8085

targos pushed a commit that referenced this pull request Nov 27, 2025
PR-URL: #60748
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
aduh95 pushed a commit that referenced this pull request Jan 9, 2026
PR-URL: #60748
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Jan 13, 2026
PR-URL: #60748
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
aduh95 pushed a commit that referenced this pull request Jan 19, 2026
PR-URL: #60748
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. performance Issues and PRs related to the performance of Node.js. whatwg-url Issues and PRs related to the WHATWG URL implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

0