url: don't update URL immediately on update to URLSearchParams#51520
url: don't update URL immediately on update to URLSearchParams#51520nodejs-github-bot merged 18 commits intonodejs:mainfrom MattIPv4:url-searchparams-perf
Conversation
|
Review requested:
|
This comment was marked as resolved.
This comment was marked as resolved.
This appears to keep the "calling stringifier with this = {} didn't throw TypeError" test happy
|
|
|
WPT tests can't be changed. I recommend changing them on upstream if you think there is a bug. |
|
Ah, hm. That might explain why this is implemented the rather inefficient way it is currently then, as |
|
I've asked in the WPT Matrix as to why those tests expect the encoding to behave the way it does, but I believe this push should achieve the same performance benefit while only switching to URLSearchParams once they've actively been updated. |
|
Added a little benchmark, very open to suggestions on if there is a better way to do that. It seems to show a marked improvement with this fix though: |
|
Also, included a benchmark to check that the added logic in |
Co-authored-by: Antoine du Hamel <[email protected]>
|
Landed in 925a464 |
|
Should I have squashed the commits here before they were merged? I notice the commit into main uses the commit message of the first commit here, rather than the PR title, which results in what is now a bit of a misleading commit message? |
Yeah the CQ when used with
commit-queue-squash
|
|
Ah okay, TIL! Is the not-particularly-accurate commit message in main worth worrying about (might be confusing, esp. for the changelogs etc.)? |
|
It's unfortunate, but we're way passed the 10 minute window, so the commit will stay as is. It might be worth opening a PR backporting it to 21.x-staging branch with the correct commit message (since that's the commits on that branch that actually end up on the changelog). node/doc/contributing/collaborator-guide.md Lines 775 to 777 in 62fc950 |
|
Ack, no worries. I'll look at getting a backport up for 21.x (and ideally 20.x as well). |
|
Would someone be able to add the backport open label for 21.x here, please? ❤️ |
It might not be necessary, IIRC releasers will cherry-pick all the commits from the |
PR-URL: nodejs#51520 Fixes: nodejs#51518 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: nodejs#51520 Fixes: nodejs#51518 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: #51520 Fixes: #51518 Backport-PR-URL: #51559 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: nodejs#51520 Fixes: nodejs#51518 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: #51520 Fixes: #51518 Backport-PR-URL: #51559 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: #51520 Fixes: #51518 Backport-PR-URL: #51559 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
|
Filed some issues w/ browsers etc. for the same performance issue, as this fix seems to have worked for Node.js w/o issue (knock on wood): |
This removes the performance impact caused by updating
URLwhen interacting withURL.searchParams, moving that cost to the first access ofURL.search,URL.href,URL.toString(), orURL.toJSON(), or to the first update of any part of theURL.Fixes: #51518