url: speed up URLSearchParams - #65363
Open
anonrig wants to merge 2 commits into
Open
Conversation
Collaborator
|
Review requested:
|
This was referenced Aug 18, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65363 +/- ##
==========================================
- Coverage 90.31% 90.13% -0.18%
==========================================
Files 751 752 +1
Lines 249956 251853 +1897
Branches 47204 47368 +164
==========================================
+ Hits 225745 227005 +1260
- Misses 15612 16180 +568
- Partials 8599 8668 +69
🚀 New features to boost your workflow:
|
jasnell
requested changes
Aug 18, 2026
jasnell
left a comment
Member
There was a problem hiding this comment.
AI agents are not permitted to use Signed-off-by
cursor
Bot
force-pushed
the
cursor/url-searchparams-performance-603e
branch
from
August 18, 2026 11:39
1423a66 to
e18874e
Compare
Member
Author
|
Removed the |
cursor
Bot
force-pushed
the
cursor/url-searchparams-performance-603e
branch
from
August 18, 2026 12:49
e18874e to
9863db8
Compare
Parse query strings with indexOf instead of a per-character state machine, skip ToString when values are already strings, cache toString() until the list mutates, and join serialized pairs. Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com> Assisted-by: Cursor Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Leave lone '%' and non-hex percent sequences intact so serialization matches the previous parser, and use native indexOf/slice/push on the query-string hot path. Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com> Assisted-by: Cursor Co-authored-by: Cursor Agent <cursoragent@cursor.com>
cursor
Bot
force-pushed
the
cursor/url-searchparams-performance-603e
branch
2 times, most recently
from
August 18, 2026 18:09
4ed2bdd to
18331fb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This speeds up WHATWG
URLSearchParamswithout changing observable behavior.Independent of the
new URL()parse PR (#65361).What changed
&/=withindexOfinstead of a per-character state machine. When the input has no+or%, each component is a slice of the original string. Percent-decoding still runs only when a complete%HHsequence exists, so lone%and fake sequences like%©stay intact.`${value}`when the value is already a string (constructor,append/get/set/has/delete).toString()until the list mutates; join encoded pairs instead of repeated+=.test/parallel/test-whatwg-url-searchparams-fast-path.jscovers leading?, empty pairs,+/ percent-decoding, invalid%, mutation cache invalidation, copy constructor isolation, record/sequence init, unpaired surrogates, and fake percent-encoding.Tests
test/parallel/test-whatwg-url-custom-searchparams*.jsplus the new fast-path filetest/wpt/test-url.js: 5107 passed, 0 unexpected failuresLocal benches
Same binary family, both run with
--no-node-snapshot(new JS is not in the V8 snapshot). Rates in ops/s:new URLSearchParams(string)noencodenew URLSearchParams(string)encodemanynew URLSearchParams(iterable)toString()noencode (repeated)toString()encodemany (repeated)get()has()The large
toString()jump is the serialization cache: the common “build params, stringify many times / readURL.href” path no longer re-encodes an unchanged list.Ada already has a C
url_search_paramsAPI. This keeps the implementation in JS to avoid a JS/C++ call on everyget/append.Assisted-by: Cursor