mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #396] [MERGED] perf: pre-split route patterns and hoist URL split out of match loop #540
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#540
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/396
Author: @NathanDrake2406
Created: 3/10/2026
Status: ✅ Merged
Merged: 3/10/2026
Merged by: @james-elicx
Base:
main← Head:perf/route-match-presplit📝 Commits (3)
68e9402perf: pre-split route patterns and hoist URL split out of match loop6c9d5dbMerge remote-tracking branch 'origin/main' into perf/route-match-presplit8b48a14update entry-templates snapshots📊 Changes
9 files changed (+144 additions, -93 deletions)
View changed files
📝
packages/vinext/src/entries/app-rsc-entry.ts(+7 -5)📝
packages/vinext/src/entries/pages-server-entry.ts(+5 -6)📝
packages/vinext/src/routing/app-router.ts(+12 -5)📝
packages/vinext/src/routing/pages-router.ts(+11 -5)📝
tests/__snapshots__/entry-templates.test.ts.snap(+100 -71)📝
tests/api-handler.test.ts(+1 -1)📝
tests/app-router.test.ts(+2 -0)📝
tests/entry-templates.test.ts(+4 -0)📝
tests/shims.test.ts(+2 -0)📄 Description
Summary
matchPattern) was re-splitting both the URL and pattern strings on every loop iteration. For N routes checked before a match, that's N redundanturl.split("/")calls (same URL every time) + Npattern.split("/")calls (patterns are static after scan)patternParts: string[]toRouteandAppRouteinterfaces, computed once at filesystem scan timematchRoute/matchAppRoutebefore the loop, pass pre-split arrays tomatchPatternfindIntercept) to use the new array-based APITest plan
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.