-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
perf: avoid slow searchParams mutation in manifest prefetching #14084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: avoid slow searchParams mutation in manifest prefetching #14084
Conversation
|
Hi @richardscarrott, Welcome, and thank you for contributing to React Router! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected]. Thanks! - The Remix team |
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
Huh - nice find! Will get this merged this week 👍 |
🤖 Hello there, We just published version Thanks! |
7.7.0https://stackblitz.com/edit/github-xjqtafn4-nkhw9euc?file=package.json 7.8.0-pre.0https://stackblitz.com/edit/github-xjqtafn4-xk9orcbd?file=package.json I also tested a production build locally and all LGTM 👍 |
🤖 Hello there, We just published version Thanks! |
This PR improves the performance of
fetchAndApplyManifestPatches
by avoiding direct mutation ofurl.searchParams
, which turns out to be unbelievably slow (thesort()
is absolutely fine in comparison).https://issues.chromium.org/issues/331406951
nodejs/node#51518
This resolves #14075, where this performance bottleneck became noticeable when preloading thousands of paths during fog-of-war route discovery.
As @brophdawg11 notes in the issue, there's definitely room for algorithmic improvements on top of this — but figured it was worth sending this simple (but significant) optimisation initially as it's an easy win.