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>
|
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>
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:
|
|
The test coverage gaps in this should be looked at |
Commit Queue failedThe pull request was removed from the Commit Queue and labeled
commit-queue-failed
Full Commit Queue output |
|
This pull request has conflicts with its base branch, removing the |
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.