Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 62459a7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
brenelz
marked this pull request as ready for review
November 24, 2026 02:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Server link claims still cost a measurable share of SSR time on pages with many links, even after #701. On the framework-tracker
/server-side-renderedpage (1000 row links to/server-side-rendered/<id>), turning the claim handler off entirely raises SSR throughput by about 21% on a Linux runner. Separately, client builds shipplainHrefand its regex even though only server claims call it.Root cause
setupServerLinkClaimssends every anchor throughmanagedLinkUrl(attribute normalization,plainHref,isUnderBase) and then through the location matcher. On a list page almost none of those links can be active. A link is only active when its path equals the location or is a parent of it, so any href longer than the location, or one that is not a prefix of it, can never match.The client size issue comes from how the bundler splits chunks. It fixes a shared chunk's cross-chunk exports before the minifier removes the
isServerbranches, so a server-only call inclaims.tskeeps theutils.tsfunction it imports alive in the client's routing chunk.What changed
plainHrefMisses(href, loc)insrc/claims.tsreturns true for a plain root-relative href (charactersURLkeeps verbatim, no dot segments, no//start, no trailing slash) that is longer than the comparable location or is not a prefix of it. The handler then returns""before building the attrs object. A plain href's comparable path is just its lowercase form, so this is exactly the matcher's rule:loc === pathneeds equal length, andloc.startsWith(path + "/")needs a longer location.router.location.pathnamechanges.utils.tsexportsserverPlainPathandserverPlainHref(isServer ? fn : undefined), andclaims.tscalls those instead of importingisPlainPathandplainHrefdirectly. In client builds both bindings fold toundefined, so neither function nor its regex ships.plainHrefstays exported for the server fuzz test, which does not affect app bundles.Rendered HTML is unchanged. On the tracker page it is identical to
mainonce per-request UUIDs and asset hashes are stripped.Verification
pnpm test: 762 client tests, 112 server tests andtest:typespass.A new fuzz test in
test/server/plain-href-fast-path.spec.tschecks 100,000 random href/location pairs (mixed case,./..,%41, trailing slashes, queries, hashes). No href thatlinkMatchermarks active or current is ever reported as a miss. Fixed cases cover both outcomes.SSR throughput on Linux: ubuntu-latest (AMD EPYC 7763), with the tracker's
app-solidbuilt against router tarballs packed frommain(7347290), this branch, andmainwith the claim handler returning""at once. The server runs innode:24.22.1-bookworm-slimpinned to CPUs 0-2, and autocannon in a second container on CPU 3. Each run is 10 connections, a 10 s warmup and a 20 s measurement, over six interleaved rounds:mainThe early exit recovers about 73% of the throughput the claim handler costs on this page.
Instructions retired per request, measured in-process with
handleRequeston macOS arm64 (/usr/bin/time -l, three interleaved rounds, after a 200-request warmup with the warmup cost subtracted):main41.8M–42.2M, this branch 38.9M–39.0M (about −7%), claim handler off 35.8M–36.9M. Of what remains, theisPlainPathregex is about 0.8M per request, which keeps the check sound.Client JS on the same app: 142,367 to 142,080 B minified (−287 B), 48,955 to 48,819 B brotli (−136 B). Dropping
plainHrefsaves 313 B minified, and the early exit adds 26 B.Open
🤖 Generated with Claude Code