Skip to content

perf(home): cut home page weight, stream the teaser over HLS and cache media - #51

Merged
maxitect merged 12 commits into
mainfrom
feat/35-performance-home-page-weight-images-caching-and
Nov 13, 2026
Merged

maxitect merged 12 commits into
mainfrom
feat/35-performance-home-page-weight-images-caching-and

Conversation

@maxitect

@maxitect maxitect commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What

Cuts the home page from 16.8 MB to about 1.2 MB before the video (measured locally), streams the hero teaser over an HLS ladder, and gives public media a long cache lifetime. The function region is a Netlify setting and is listed under Notes.

Changes

  • Home: the three.js logo loads on demand, only on desktop with motion allowed, and only once the video plays (or after 6 s). The animation loop stops in hidden tabs and is cleaned up on unmount.
  • Home: hologram PNGs (1 MB) are WebP (0.4 MB); home.png (14 MB) is a 0.5 MB JPEG; favicon.ico goes from 197 KB to 15 KB.
  • Teaser: 480p, 720p and 1080p H.264 HLS ladder (2 s fMP4 segments) built by scripts/encode-teaser-hls.sh. Browsers with native HLS (Safari, iOS) use it; others load hls.js only when native HLS is missing; the AV1, HEVC and H.264 files stay as the fallback. Autoplay and poster are unchanged.
  • CSP: media-src allows blob: for hls.js.
  • About: carousel images use fill with sizes, so phones download a 640 px image instead of 3840 px.
  • Layout: Jost loads weights 400 to 700 instead of nine.
  • Music: YouTube and Bandcamp iframes are lazy.
  • Cache: netlify.toml sends Cache-Control: public, max-age=2592000 for /videos, /images, /hologram and /svg.

Acceptance criteria

AC Result Method Evidence
Lighthouse mobile on production: / 90+, blocking time under 200 ms PASS locally, production pending cli Local production build: 93, TBT 0 ms, LCP 3.1 s (AC1)
/tour LCP under 2.5 s, layout shift under 0.1 Not in this PR n/a Depends on #27, see Notes
Home transfers under 3 MB before the video starts PASS browser 1,239 KB, including hls.js and three.js (AC2)
Logo appears and animates on desktop, absent with reduced motion PASS browser canvas present on desktop, 0 with reduced motion, 60 fps visible and 0 hidden (AC3)
Home document under 300 ms from Europe PENDING user step deploy Needs the Netlify region change (Notes); preview still answers in about 0.4 s from the Ohio region (AC6)
Repeat visit loads images and video from cache PASS deploy Preview serves 30-day cache-control on media and /_next/image (AC7)
Pages look the same PASS browser About page at 1280 and 390 px matches production (AC4)
HLS: starts quickly at a low rung on Slow 4G, reaches 1080p on a fast link PASS browser AC5

Closes

Closes #35

Notes

  • Netlify UI step: set the functions region to Frankfurt (eu-central-1, next to the Neon database) under Site configuration > Functions. Adapter-generated functions cannot set it in code, and it needs a redeploy. Region selection may need a paid plan; check before changing.
  • Production Lighthouse before and after must be recorded in Performance: home page weight, images, caching and function region #35 after merge and the region change.
  • /tour is left for the re-measurement after Serve Google Sheets content from the server with Cache Components #27, as the ticket says.
  • The media in public/ keeps its filenames, so it caches for 30 days rather than a year. Give a replaced file a new name.
  • public/videos/hls adds 44 MB to the repository (22, 14 and 7 MB per rung). The ladder is encoded from the original 34 MB master, which the script reads from git history (b7ba479^:public/videos/teaser.mp4), not from the H.264 fallback.
  • Headless Chrome here has native HLS, so the hls.js path was forced by hiding canPlayType for HLS. Safari was not tested.
  • On Slow 4G the video starts at about 6.4 s with hls.js and 8.6 s with Chrome's native HLS, from navigation; about 3.5 s of that is loading the page itself on the throttled link.

Review

Verdict: ALL CLEAR
Rounds: 2

Finding Severity Resolution
HLS ladder encoded from the H.264 RF 27 fallback, not the original master (second-generation loss on the rung most visitors get) warning fixed in 54857da
Ladder adds 44 MB of video to the public repo suggestion open: acceptable as is; Netlify serves public/ either way and a squash merge keeps the superseded encode off main. Moving it to object storage is the user's call

Re-verified: HLS ladder (browser) PASS: native and hls.js reach 1080p with no console errors or CSP violations; Slow 4G starts at 8.5 s on 480p (production build, same as the author's 8.6 s) · 1080p rung VMAF against the master 92.1 (previously 88.6; the AV1 file scores 78.3), checked by eye at the same frames · Pages look the same (browser) PASS: home with reduced motion and music, 1280 and 390 px, English and French, matching production · rebased onto main after #50 · check.sh PASS

Evidence

AC1

lighthouse --form-factor=mobile (local production build, port 4035)
perf 93 LCP 3.1 s TBT 0 ms CLS 0
lighthouse --preset=desktop: perf 100 LCP 0.5 s TBT 0 ms

AC2

non-HLS requests on load, sum of encoded sizes: TOTAL non-HLS KB: 1239
  of which: hls.js 176, three.js 133, poster 183, hologram 4 x 79-127, fonts, app chunks

AC3

desktop 1280, motion allowed:  canvas 1, console problems: none
reduced motion:                canvas 0, problems: none
mobile 390:                    canvas 0
requestAnimationFrame per second: visible 60, hidden 0, visible again 60

AC4

about page, 1280 and 390 px, branch vs https://clarksbowlingclub.com: screenshots match
first carousel image: /_next/image?...argentic.jpg&w=640 at 390 px (production: w=3840)

AC5

fast, hls.js forced (blob: source): started 0.65 s, 1 x 480p then 34 x 1080p segments, videoWidth 1920, no CSP violations, no console errors
slow 4G (1.6 Mbit/s, 150 ms), hls.js:    started 6.4 s, every segment 480p, videoWidth 1127, no errors
slow 4G, Chrome native HLS:              started 8.6 s, every segment 480p

AC6

$ for i in 1 2 3; do curl -s -o /dev/null -w "ttfb %{time_starttransfer}s\n" https://deploy-preview-51--clarksbowlingclub.netlify.app/; done
ttfb 0.393372s   ttfb 0.396628s   ttfb 0.485158s

AC7

$ curl -sI https://deploy-preview-51--clarksbowlingclub.netlify.app/videos/hls/1080p/segment-001.m4s
HTTP/2 200
cache-control: public,max-age=2592000
$ curl -sI .../images/home.jpg           -> cache-control: public,max-age=2592000
$ curl -sI .../hologram/hologram_nolight.webp -> cache-control: public,max-age=2592000
$ curl -sI ".../_next/image?url=%2Fimages%2Fcarousel%2Fargentic.jpg&w=640&q=75" -> cache-control: public,max-age=2592000

Preview playback

preview, native path: videoWidth 1920, canvas 1
preview, hls.js forced: src blob:https://deploy-preview-51--..., videoWidth 1920, canvas 1
only CSP violation: frame-src https://app.netlify.com (the preview toolbar, not the site)

@netlify

netlify Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for clarksbowlingclub ready!

Name Link
🔨 Latest commit 54857da
🔍 Latest deploy log https://app.netlify.com/projects/clarksbowlingclub/deploys/6af657484ff949741c4905a2
😎 Deploy Preview https://deploy-preview-51--clarksbowlingclub.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@maxitect
maxitect force-pushed the feat/35-performance-home-page-weight-images-caching-and branch from 57eadae to 54857da Compare November 13, 2026 00:18
@maxitect
maxitect marked this pull request as ready for review November 13, 2026 00:18
@maxitect
maxitect merged commit 19acbc6 into main Nov 13, 2026
5 checks passed
@maxitect
maxitect deleted the feat/35-performance-home-page-weight-images-caching-and branch November 13, 2026 00:19
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.

Performance: home page weight, images, caching and function region

1 participant