perf(benchmarks): slim card projection for /benchmarks hub - #704
Merged
Conversation
Flotapponnier
added a commit
that referenced
this pull request
Jun 25, 2026
…benchmarks payload) (#706) * chore(benchmarks): drop solana-tx-landing-latency (harness offline, 404 bleeding SEO) (#701) * perf(benchmarks): slim card projection cuts /benchmarks payload 3.2MB to 280KB (#704) * fix(types): widen isInsufficient to accept BenchmarkCardData slim shape Cherry-pick fallout: #704 introduced BenchmarkCardData (slim projection for the hub) but main's isInsufficient still required full Benchmark. The hub card calls isInsufficient(b) where b is the slim type, which typecheck rejected. Widening the predicate input to a structural subset lets both Benchmark and BenchmarkCardData pass without losing the runtime behavior.
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.
Root cause
/benchmarkspasses the fullBenchmark[](37 entries) into<BenchmarkGrid />, a client component. React serialises the whole prop tree into the RSC payload baked into the HTML, including fields the card never reads:extras.series7d,extras.series30d,extras.seriesByRegion24h/7d/30d,metricPanels,methodology,abstract,faq,findings,perChainExplainer,seoIntro,bestPerChain,worstPerChain,cellRanks,providersPerChain.Result on prod: 3.2 MB of HTML per hub render. The "8 s" reported in the brief was full transfer time over the wire, not TTFB (server side was ~0.46 s STALE / ~1.13 s cache miss).
Fix
Add
BenchmarkCardData(slim) +toBenchmarkCardDataprojection insrc/data/benchmarks.ts. Hub and category pages map to the slim shape before passing to the grid. Card/grid/mini-chart prop types updated;MiniChartaccepts a structural subset so the home table can keep passing fullBenchmark.No loader change, no query change. Pure wire-payload trim.
Before / after
Local prod build,
curl /benchmarks:92% HTML payload reduction. TTFB stays sub-second.
Alternatives considered
tryLoadLiveto parallel per provider: not the bottleneck for the hub, but worth doing for individual bench pages. Out of scope.Diff stats
Test plan
pnpm typecheckcleanpnpm test114 passpnpm buildsucceeds,/benchmarksstatic HTML drops 3.2 MB to 283 KBpnpm lintno new warnings