Repository navigation
docs(skills): measured perf guidance — async include sizing, cache() economics, typecheck scaling, CF timing caveat - #668
Merged
Conversation
…economics, typecheck scaling, CF timing caveat Findings from the 26k-route stress app's deployed-edge benchmark (tests/cloudflare-stress-demo BENCHMARK-2026-07-04-edge-26k.md, lands separately on feat/stress-demo-bench-overhaul), distilled into the skills so the numbers steer route-group design: - composability: "Sizing async include groups (measured)" — first-hit cost scales with routes-per-chunk (~75ms at 240 routes vs ~188ms at 9k on the edge), so prefer more, smaller groups; async-in-async chains multiply first-hit (3 levels = 464ms) so keep nesting shallow; same-staticPrefix siblings import together so give groups distinct prefixes. Warm matching stays O(segments) regardless. - route: cross-reference from Nested Routes steering module composition toward code-split include() with the sizing rules. - caching: "When cache() does not pay" — measured hit (36ms p50) vs miss (35ms) for a trivial page on real Cache API; cache() wins proportionally to the render cost it saves, so do not wrap cheap pages. - typesafety (generated-files-and-cli): "Typecheck cost when composing many include modules" — inference through dozens of include thunks measured at 4.05M instantiations / 20s vs 140k / 3.6s with wide UrlPatterns<any> annotations on intermediate modules; UrlPatterns<unknown> breaks handler assignability. Routing-table row added in the hub. - observability: deployed-CF caveat — timers are frozen during request execution, so Server-Timing reads ~0 on the edge; the waterfall is a local diagnostic, production analysis uses client-observed timing and structured telemetry.
commit: |
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.
Problem statement
The skills describe WHAT async include(), cache(), and debugPerformance do, but gave a consumer no numbers to size decisions with: how big should an include group be, when does cache() actually pay, why does typecheck crawl in a many-include app, and why Server-Timing reads ~0 on a deployed worker. All four now have measured answers from the 26k-route stress app's deployed-edge benchmark (#667, BENCHMARK-2026-07-04-edge-26k.md).
What a consumer reads differently
include()with a pointer to the sizing rules.UrlPatterns<any>; notes thatUrlPatterns<unknown>breaks handler assignability, that named-route typing is unaffected (it comes from the gen file), and to diagnose withtsc --extendedDiagnostics.Code-change summary
Markdown only, 6 files, +97 lines. No frontmatter changes (skills catalog unaffected).
Test plan
node tools/check-skills.mjs— 43 skills, frontmatter valid, cross-references resolvenode tools/check-doc-links.mjs— all internal links resolvepnpm run format/ lint — cleanNotes
The cited benchmark document lands in #667 — merge that first (or together) so the reference resolves in-repo; the numbers themselves are inlined here and stand alone.