Skip to content

perf: reduce docs sidebar prefetch eagerness#289

Open
brendanjryan wants to merge 3 commits intomainfrom
perf/sidebar-prefetch-intent
Open

perf: reduce docs sidebar prefetch eagerness#289
brendanjryan wants to merge 3 commits intomainfrom
perf/sidebar-prefetch-intent

Conversation

@brendanjryan
Copy link
Copy Markdown
Contributor

Summary

  • pin vocs to wevm/vocs#420, which adds configurable link prefetching (none, intent, view)
  • switch the docs sidebars to prefetch: 'intent' so visible sidebar links no longer eagerly warm every route on page load
  • add scripts/perf-harness.ts plus pnpm perf:harness to measure route-level Lighthouse metrics, no-interaction network attribution, and cold-vs-intent sidebar navigation latency

Benchmark Summary

Switching sidebar prefetching from view to intent cuts off-route load bloat on heavy docs pages without materially slowing navigation.

Route Off-route bytes before Off-route bytes after Request delta
/accounts 1.55 MB 534 KB 7 -> 3
/quickstart/faucet 7.68 MB 363 KB 12 -> 2
/guide/payments/send-a-payment 11.75 MB 534 KB 14 -> 3
/guide/stablecoin-dex/providing-liquidity 10.77 MB 746 KB 15 -> 4

Navigation on /guide/payments/send-a-payment stayed effectively flat:

  • cold sidebar click: 83ms -> 87ms
  • hover-then-click: 104ms -> 103ms

A fresh spot-check from this branch reproduced the same shape:

  • /guide/payments/send-a-payment: 534.3 KB off-route, 97ms cold click, 94ms intent click

Verification

  • bun run check:types
  • bun run check (existing unrelated warnings remain in scripts/lighthouse.ts and src/components/guides/EmbedPasskeys.tsx)
  • bun run build
  • bun run perf:harness --pages /guide/payments/send-a-payment --runs 1 --skip-build --skip-bundle

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tempo-docs Ready Ready Preview, Comment Apr 13, 2026 4:51pm

Request Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a573134b60

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +478 to +479
if (pathname.startsWith('/assets/') || contentType.includes('javascript')) return 'js'
if (contentType.includes('text/css') || pathname.endsWith('.css')) return 'css'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Count off-route asset fetches in off-route totals

In captureNetworkSummary, asset requests are bucketed as js/css/image before checking whether they belong to the current route, so prefetched chunks for other pages are never labeled off-route. Because offRouteBytes and offRouteRequests are later computed only from category === 'off-route', the harness under-reports off-route traffic on pages that prefetch route assets, which can materially skew the benchmark comparisons this script is intended to produce.

Useful? React with 👍 / 👎.

Comment on lines +571 to +573
if (!output) return
cleanup()
reject(new Error(output))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid failing preview detection on non-error stderr logs

detectPreviewUrl currently rejects as soon as any non-empty stderr chunk is emitted, which makes the harness fail even when pnpm preview is healthy but prints warnings/noise to stderr (for example runtime warnings). This creates flaky startup failures unrelated to server availability and can block perf runs in otherwise valid environments.

Useful? React with 👍 / 👎.

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