Conversation
Skip the ada reparse when a setter is given the value already stored on the URL, and skip the component slice when the lengths differ. Empty host and a lone "?" or "#" still go through ada, because those assignments are not idempotent. URLSearchParams records with no symbol keys use Object.keys. Repeated get, getAll, and has of the same string skip a second USVString conversion. URL.canParse and URLPattern.prototype.test use the one-byte fast API. Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
Collaborator
|
Review requested:
|
Debug builds count url.canParse and url.canParse.withBase. The one-byte fast path renamed those keys, so the shared debug jobs saw a count of 0. Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
jasnell
approved these changes
Sep 21, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #66188 +/- ##
==========================================
- Coverage 90.28% 90.28% -0.01%
==========================================
Files 790 790
Lines 272044 272231 +187
Branches 51949 51990 +41
==========================================
+ Hits 245625 245782 +157
- Misses 16915 16966 +51
+ Partials 9504 9483 -21
🚀 New features to boost your workflow:
|
Member
|
The test coverage gaps in this should be looked at |
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.
Why
URL setters always reparsed the href, including when the assigned value was already the serialized component.
URLSearchParamsbuilt from a record walkedReflect.ownKeys, and everyget/hasconverted the name again.URL.canParseandURLPattern.testtook the slow string callback for ASCII input.What
A setter skips ada when the new value matches the component already stored on the href, and skips the slice when the lengths differ. An empty host or hostname, and a lone
?or#, still go through ada, because those writes are not idempotent. RecordURLSearchParamsusesObject.keyswhen there are no symbol keys. Repeatedget,getAll, andhasof the same string skip a second USVString conversion.URL.canParseandURLPattern.prototype.testuse the one-byte fast API; two-byte strings stay on the slow path.benchmark/compare.js --runs 5on macOS arm64 Release, against the parent commit built with the same toolchain. Stars in that tool mark a significant difference; the rows below are significant. Assigning the current pathname on its own went from 3.9M to 106M ops/s. Setting a different pathname was flat (+3%).whatwg-url-propertieshref, with basewhatwg-url-propertiespassword, with basewhatwg-url-propertiesport, with basewhatwg-url-propertiesprotocol, with basewhatwg-url-propertiesusername, with basewhatwg-url-propertiespathname, with basewhatwg-url-propertieshost, with basewhatwg-url-propertieshash, with basewhatwg-url-propertiessearch, with basewhatwg-url-propertieshostname, with basewhatwg-url-canParselongwhatwg-url-canParseshortwhatwg-url-canParsewswhatwg-url-canParsefilewhatwg-url-canParsejavascriptwhatwg-url-canParseauthurl-searchparams-creationobject, noencodeurl-searchparams-readhasoneurl-searchparams-readgetoneurlpattern-testexact pathname/search/hashurlpattern-testhostnametest/parallel/test-whatwg-url*,test-urlpattern*,test-url*, and WPTurl/urlpatternpass. A closed-source coding agent assisted with the implementation.