Skip to content

perf(benchmarks): slim card projection for /benchmarks hub - #704

Merged
Flotapponnier merged 1 commit into
devfrom
perf/benchmarks-hub-cold-render
Jun 25, 2026
Merged

perf(benchmarks): slim card projection for /benchmarks hub#704
Flotapponnier merged 1 commit into
devfrom
perf/benchmarks-hub-cold-render

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Root cause

/benchmarks passes the full Benchmark[] (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) + toBenchmarkCardData projection in src/data/benchmarks.ts. Hub and category pages map to the slim shape before passing to the grid. Card/grid/mini-chart prop types updated; MiniChart accepts a structural subset so the home table can keep passing full Benchmark.

No loader change, no query change. Pure wire-payload trim.

Before / after

Local prod build, curl /benchmarks:

Size TTFB
Prod (main) 3.2 MB 0.46 s STALE / 1.13 s cache miss / 8.7 s total transfer
This PR (local) 283 KB 0.076 s first hit / 0.005 s subsequent

92% HTML payload reduction. TTFB stays sub-second.

Alternatives considered

  • Bump revalidate 60 to 300 s: shifts the problem to fewer users, doesn't fix it. Skipped.
  • Build-time prerender (force static): the page already prerenders; the cost is downstream of that.
  • Refactor tryLoadLive to parallel per provider: not the bottleneck for the hub, but worth doing for individual bench pages. Out of scope.

Diff stats

6 files changed, 81 insertions(+), 10 deletions(-)

Test plan

  • pnpm typecheck clean
  • pnpm test 114 pass
  • pnpm build succeeds, /benchmarks static HTML drops 3.2 MB to 283 KB
  • pnpm lint no new warnings
  • Verify staging Preview URL renders identically

@Flotapponnier
Flotapponnier merged commit df74625 into dev Jun 25, 2026
1 check passed
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.
@Flotapponnier
Flotapponnier deleted the perf/benchmarks-hub-cold-render branch July 17, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant