react-router
react-router copied to clipboard
Improve href() with a faster trim end splat
This is a small optimization to href() to not use a backtracking regex on splat paths.
The speedup of the new trimEndSplat() method over the regex /\/*\*?$/ is about 17x to 36x speedup: jsbenchmark.com benchmark
The speedup of all of href() with options is about 1.2x to 1.5x speedup: jsbenchmark.com benchmark
This could also apply to compilePath(), but that only runs once per path at application load, not many times per page in the React render loop.
🦋 Changeset detected
Latest commit: ba26a583d1d3771afad8a56aa856163bc51ae357
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 11 packages
| Name | Type |
|---|---|
| react-router | Patch |
| @react-router/architect | Patch |
| @react-router/cloudflare | Patch |
| @react-router/dev | Patch |
| react-router-dom | Patch |
| @react-router/express | Patch |
| @react-router/node | Patch |
| @react-router/serve | Patch |
| @react-router/fs-routes | Patch |
| @react-router/remix-routes-option-adapter | Patch |
| create-react-router | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
@timdorr and @pcattori This improvement to href() has been approved for awhile. Can it be merged now?