Skip to content

url: improve urlpattern regexp performance - #57136

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
anonrig:yagiz/improve-urlpattern-performance
Feb 21, 2025
Merged

url: improve urlpattern regexp performance#57136
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
anonrig:yagiz/improve-urlpattern-performance

Conversation

@anonrig

@anonriganonrig commented Feb 19, 2025

Copy link
Copy Markdown
Member

Thanks to @erikcorry's recommendation, we can speed up regexp performance of URLPattern

Benchmarks show no improvement, but I believe that is due to our lack of proper benchmark cases. (we don't have any benchmarks that use *)

Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1658

confidence improvement accuracy (*) (**) (***)
url/urlpattern-parse.js n=100000 pattern='"[https://(sub.)?example(.com/)foo](https://(sub.)/?example(.com/)foo)"' -0.34 % ±0.57% ±0.76% ±1.01%
url/urlpattern-parse.js n=100000 pattern='{"hostname":"xn--caf-dma.com"}' * -0.50 % ±0.48% ±0.64% ±0.84%
url/urlpattern-parse.js n=100000 pattern='{"pathname":"/([[a-z]--a])"}' -0.31 % ±0.34% ±0.45% ±0.59%
url/urlpattern-parse.js n=100000 pattern='{"pathname":"/foo","search":"bar","hash":"baz","baseURL":"https://example.com:8080/"}' -0.07 % ±0.34% ±0.46% ±0.59%
url/urlpattern-test.js n=100000 pattern='"[https://(sub.)?example(.com/)foo](https://(sub.)/?example(.com/)foo)"' * 0.72 % ±0.63% ±0.84% ±1.10%
url/urlpattern-test.js n=100000 pattern='{"hostname":"xn--caf-dma.com"}' -0.39 % ±0.89% ±1.20% ±1.58%
url/urlpattern-test.js n=100000 pattern='{"pathname":"/([[a-z]--a])"}' * 0.74 % ±0.59% ±0.78% ±1.02%
url/urlpattern-test.js n=100000 pattern='{"pathname":"/foo","search":"bar","hash":"baz","baseURL":"https://example.com:8080/"}' 0.20 % ±0.75% ±0.99% ±1.29%

@anonrig
anonrig requested a review from jasnellFebruary 19, 2025 14:08
@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. whatwg-url Issues and PRs related to the WHATWG URL implementation. labels Feb 19, 2025
@codecov

codecovBot commented Feb 19, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.03%. Comparing base (baa60ce) to head (87d5b72).
Report is 398 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #57136 +/- ##
=======================================
Coverage 89.03% 89.03% =======================================
Files 665 665 Lines 193408 193408 Branches 37279 37273 -6 =======================================
+ Hits 172206 172209 +3 + Misses 13886 13885 -1 + Partials 7316 7314 -2 
Files with missing linesCoverage Δ
src/node_url_pattern.cc86.61% <100.00%> (+0.92%)⬆️

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

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@anonriganonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Feb 19, 2025
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 19, 2025
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@anonriganonrig added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. review wanted PRs that need reviews. labels Feb 19, 2025
@anonriganonrig added the commit-queue Add this label to land a pull request using GitHub Actions. label Feb 20, 2025
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Feb 21, 2025
@nodejs-github-bot
nodejs-github-bot merged commit 9e6a62f into nodejs:mainFeb 21, 2025
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 9e6a62f

acidiney pushed a commit to acidiney/node that referenced this pull request Feb 23, 2025
PR-URL: nodejs#57136
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
targos pushed a commit that referenced this pull request Feb 24, 2025
PR-URL: #57136
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
targos pushed a commit that referenced this pull request Feb 25, 2025
PR-URL: #57136
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
aduh95 pushed a commit that referenced this pull request Apr 2, 2025
PR-URL: #57136
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
aduh95 pushed a commit that referenced this pull request Apr 3, 2025
PR-URL: #57136
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
@RafaelGSSRafaelGSS added dont-land-on-v20.x dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. labels Apr 16, 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.c++Issues and PRs that require attention from people who are familiar with C++.dont-land-on-v22.xPRs that should not land on the v22.x-staging branch and should not be released in v22.x.needs-ciPRs that need a full CI run.review wantedPRs that need reviews.whatwg-urlIssues and PRs related to the WHATWG URL implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@anonrig@nodejs-github-bot@mcollina@jasnell@UlisesGascon@pmarchini@RafaelGSS