Skip to content

perf: homepage load speed, image, and icon-font optimizations#310

Merged
ashtonanderson merged 5 commits into
mainfrom
perf/homepage-combined
Jun 9, 2026
Merged

perf: homepage load speed, image, and icon-font optimizations#310
ashtonanderson merged 5 commits into
mainfrom
perf/homepage-combined

Conversation

@ashtonanderson

Copy link
Copy Markdown
Member

Combines three complementary homepage/app performance optimizations. Measured via headless-Chrome A/B (median runs) against main.

Results — homepage first load (cold cache)

Metric main this PR Δ (good wifi) Δ (slow-4G)
Wall-clock load 5.5 s / 53 s 1.4 s / 11 s −74% −79%
Time to interactive (DCL) 1118 ms 234 ms −79% −79%
Total page weight 10.52 MB 2.15 MB −80% −80%

What's included

1. JS bundle (speed up homepage and app initial load)

  • Lazy-load Chessground (ErrorBoundary, PlaySetupModal) via next/dynamic
  • Split barrel imports (src/contexts, src/components) to direct paths so the shared _app chunk tree-shakes (565 kB → 292 kB)
  • Material Symbols font-load guard: hide icons until the font is ready (kills the "down_arrow" ligature-text flash)

2. Images (optimize homepage images)

  • Team avatars + paper previews → next/image (responsive, WebP/AVIF, lazy below the fold)
  • scripts/optimize-images.mjs downscales oversized source assets in place (7.6 MB → 0.57 MB). Image bytes on the homepage: −99%.

3. Icon font + favicon (shrink Material Symbols icon font and favicon)

  • The font URL requested the full variable font across every axis range → Google served a 3.8 MB woff2 (the single largest resource on every page). Only wght 200-400 and FILL 0/1 are used, so pin opsz=24/GRAD=0 and narrow ranges → ~1.1 MB instance (−72%).
  • favicon.png 809×809/104 KB → 64×64/2.8 KB.

First paint (FCP/LCP) is unchanged — these target time-to-interactive and full-load, not the critical render path.

🤖 Generated with Claude Code

ashtonanderson and others added 5 commits June 8, 2026 20:52
- Lazy-load Chessground in ErrorBoundary and PlaySetupModal via next/dynamic
- Split barrel imports (src/contexts, src/components) to direct paths for
  better tree-shaking and code-splitting
- Optimize Material Symbols font loading (preconnect/preload, swap, and
  hide icons until the font is ready to avoid layout flash)
- Homepage component updates (GameCarousel, HomeHero, index)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Convert team avatars and paper-card previews from raw <img> to next/image
  (responsive srcset, WebP/AVIF delivery, automatic lazy-loading below fold)
- Add scripts/optimize-images.mjs and downscale oversized source assets in
  place (team avatars to 320px, paper previews to 900px): 7.6MB -> 0.57MB

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The icon font URL requested the full variable font across every axis range
(opsz/wght/FILL/GRAD), making Google serve a ~3.8MB woff2 - the single largest
resource on every page and the long pole on the load event. Only wght 200-400
and FILL 0/1 are actually used, so pin opsz=24/GRAD=0 and narrow the ranges:
Google now serves a ~1.1MB instance (-72%). Also downscale favicon.png from
809x809/104KB to 64x64/2.7KB.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
maia-platform-frontend Ready Ready Preview, Comment Jun 9, 2026 5:03am

Request Review

@ashtonanderson ashtonanderson merged commit 7e46906 into main Jun 9, 2026
6 checks passed
@ashtonanderson ashtonanderson deleted the perf/homepage-combined branch June 9, 2026 05:15
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