Skip to content

Conversation

richardscarrott
Copy link
Contributor

@richardscarrott richardscarrott commented Jul 26, 2025

This PR improves the performance of fetchAndApplyManifestPatches by avoiding direct mutation of url.searchParams, which turns out to be unbelievably slow (the sort() is absolutely fine in comparison).

https://issues.chromium.org/issues/331406951
nodejs/node#51518

Screenshot 2025-07-26 at 21 52 18 Screenshot 2025-07-26 at 21 52 28

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.

Copy link

changeset-bot bot commented Jul 26, 2025

⚠️ No Changeset found

Latest commit: c411503

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jul 26, 2025

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 CLA Signed label will be added to the pull request.

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

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jul 26, 2025

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

@brophdawg11
Copy link
Contributor

Huh - nice find! Will get this merged this week 👍

@brophdawg11 brophdawg11 self-assigned this Jul 28, 2025
@brophdawg11 brophdawg11 merged commit 86a3dd5 into remix-run:dev Jul 28, 2025
1 check passed
Copy link
Contributor

github-actions bot commented Aug 5, 2025

🤖 Hello there,

We just published version 7.8.0-pre.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@richardscarrott
Copy link
Contributor Author

richardscarrott commented Aug 7, 2025

7.7.0

https://stackblitz.com/edit/github-xjqtafn4-nkhw9euc?file=package.json

7.8.0-pre.0

https://stackblitz.com/edit/github-xjqtafn4-xk9orcbd?file=package.json

I also tested a production build locally and all LGTM 👍

Copy link
Contributor

github-actions bot commented Aug 7, 2025

🤖 Hello there,

We just published version 7.8.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default <Link /> behaviour (discover="render") causes performance issues in large lists
2 participants