Repository navigation
perf(docsite): serve homepage images at their display size - #11331
Conversation
The homepage hero reel, the themes card, the discover cards and the reel's member avatar loaded 0.5-1.6 MB PNGs and showed them at 11-265 px. They now load WebP copies sized for their largest display at 3x pixel density (19.5 MB of PNGs become 454 KB). Blog byline avatars ask GitHub for a 128 px image instead of the full upload.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Requesting changes. The image swap itself holds up: every homepage image now points at a WebP copy no larger than its source, and the copies look the same at their display size. Four statements about the files and their sizes need correcting.
- The description says the original PNGs stay because the
/themespages show them at full size, butpublic/discover-card-1.pngto-4.png,public/neutral/preview-{watch,headphones,backpack}.pngandpublic/images/avatars/DATA-Ami-Pena.pngare referenced by nothing after this change, so please say these eight stay only so their old URLs keep loading (or remove them). - The comment at
apps/docsite/src/app/(site)/_landing/hero/heroThemeContent.ts:100-101says each copy is at least 20 times smaller than its PNG, buthero/butter-headphones.webpis 16.9 times andhero/butter-watch.webp19.6 times smaller, so please drop that sentence. - Miss:
ThemesPreview.tsx:31-32and the description say the Themes card photos show at 90 px or less, but once the store window reaches its 360 px cap each photo draws at about 101 px (measured on every screen from 600 to 1,000 px wide), so please say about 100 px (the 320 px copies still cover 3x). - Miss: the description's "shown at 265 px or less" and the comment at
heroThemeContent.ts:99-100("sharp on the largest card at 3x") leave out the 768 to 1,023 px collage, where the photos draw at 288 to 315 px, so a 932 px landscape phone at 3x needs about 864 device px against the 768 px Matcha and Astryx copies; please cut those copies wider or state the coverage that holds.
A small follow-up that does not block: the blog README still documents the GitHub avatar default without ?size=128.
Claims and files checked
- Claim: the homepage photos were 0.5 to 1.6 MB PNGs. Verified (545 KiB to 1.6 MiB for the product photos).
- Claim: the photos were shown at 11 to 265 px. False at the top end: the 768 to 1,023 px collage draws them at up to 315 px.
- Claim: hero reel photos become WebP at most 768 px wide, 12 to 49 KB. Verified (700 to 768 px, 12.0 to 49.0 KiB).
- Claim: 768 px is sharp at 3x on the largest card, and the copies are sized for their largest display at 3x. False in the 768 to 1,023 px collage at 3x.
- Claim: the member avatar becomes a 96 px, 2 KB WebP shown at about 20 px. Verified (1.7 KiB; a 24 px avatar scaled to 0.85).
- Claim: Themes card photos become 320 px WebP, 8 to 14 KB. Verified (8.5 to 13.8 KiB).
- Claim: Themes card photos show at 90 px or less. False: 100.6 px on screens 600 to 1,000 px wide.
- Claim: Discover cards become WebP at most 560 px wide, 9 to 16 KB, shown at 260 px or less. Verified.
- Claim: blog byline avatars show at 40 px or less and now ask GitHub for 128 px. Verified (20 and 36 px).
- Claim: 19.5 MB of PNGs become 454 KB of WebP. Verified (19,520 KiB to 454 KiB).
- Claim: the reel preloads every slide's photos on mount. Verified (an idle warm-up after mount, fed by the same content map).
- Claim: the docsite uses no image component and already ships pre-sized public files. Verified.
- Claim: no request-time work, no new CI step and no changeset needed. Verified.
- Claim: the original PNGs stay because the themes pages show them at full size. False for eight files, which nothing references after this change.
- Claim: the Templates card illustrations are left to a separate change that serves them through the image optimizer. Verified on the base branch.
- Claim: no current record governs homepage image files. Verified.
- Claim: nothing looks different and the differences are compression noise. Consistent: the copies score SSIM 0.95 to 0.99 at display size, and the Discover colours are converted correctly to sRGB.
- Claim: the docsite build passes. Verified: CI's docsite build, build and typecheck jobs succeeded for this head.
- Claim: the phone and desktop timing results, and the encoder settings. Not reproduced.
- File: 26 WebP files under
apps/docsite/public/landing/. Clear: valid WebP, never larger than the source, visually equivalent. - File:
DiscoverShowcase.tsx. Clear. - File:
ThemesPreview.tsx. Finding: the comment at lines 31-32. - File:
HeroFloatingCards.tsx. Clear. - File:
heroThemeContent.ts. Findings: the comment at lines 99-101. - File:
authors.ts. Clear.
|
/approve-spec 20fe2f4 |
Not every WebP copy is 20 times smaller than its PNG (the Butter headphones copy is 17 times smaller).
|
/approve-spec d859acd |
There was a problem hiding this comment.
Requesting changes. The image swap itself holds up, and the two earlier points are fixed: the description now says why the eight unreferenced PNGs stay, and the 20x sentence is gone; three size statements still need correcting.
- Miss: the description's "shown at 265 px or less" and the comment at
apps/docsite/src/app/(site)/_landing/hero/heroThemeContent.ts:99-100("sharp on the largest card at 3x") leave out the 768 to 1,023 px collage, where the photos draw at 288 to 315 px, so a 932 px landscape phone at 3x needs about 864 device px against the 768 px Matcha and Astryx copies; please cut those copies at about 960 px or state the coverage that holds. - Miss:
ThemesPreview.tsx:31-32and the description say the Themes card photos show at 90 px or less, but once the store window reaches its 360 px cap each photo draws at about 101 px (screens 600 to 1,023 px wide), so please say about 100 px (the 320 px copies still cover 3x). - The description's "17 to 67 times smaller" for the hero photos is wrong at the top end, because
hero/neutral-headphones.webpis 75.9 times smaller than its PNG, so please say 17 to 76 times or drop the ratio.
A small follow-up that does not block: the blog README still documents the GitHub avatar default without ?size=128.
Claims and files checked
- Claim: the homepage photos were 0.5 to 1.6 MB PNGs. Verified (545 KiB to 1.6 MiB for the product photos).
- Claim: the photos were shown at 11 to 265 px. False at the top end: the 768 to 1,023 px collage draws them at up to 315 px.
- Claim: hero reel photos become WebP at most 768 px wide, 12 to 49 KB. Verified (700 to 768 px, 12.0 to 49.0 KiB).
- Claim: the hero copies are 17 to 67 times smaller. False: 16.9 to 75.9 times.
- Claim: 768 px is sharp at 3x on the largest card. False: the collage needs about 864 device px at 3x, and 768 px covers 3x only up to 256 CSS px.
- Claim: the member avatar becomes a 96 px, 2 KB WebP shown at about 20 px. Verified (1.7 KiB, drawn at 19 to 22 px).
- Claim: Themes card photos become 320 px WebP, 8 to 14 KB. Verified (8.5 to 13.8 KiB).
- Claim: Themes card photos show at 90 px or less. False: about 101 px on screens 600 to 1,023 px wide.
- Claim: Discover cards become WebP at most 560 px wide, 9 to 16 KB, shown at 260 px or less. Verified (522 to 560 px, 8.6 to 16.2 KiB; the card style caps at 260 px).
- Claim: blog byline avatars show at 40 px or less and now ask GitHub for 128 px. Verified (20 and 36 px avatars; the URL carries
?size=128). - Claim: 19.5 MB of PNGs become 454 KB of WebP. Verified (19,520 KiB of source PNGs to 454 KiB).
- Claim: the reel preloads every slide's photos. Verified (an idle warm-up after mount, fed by the same content map).
- Claim: the themes pages still show the Butter, Matcha, Gothic and Y2K photos at full size, and the eight other originals stay only so their URLs keep loading. Verified: nothing references those eight.
- Claim: the docsite uses no image component, already ships pre-sized public files, and its image optimizer keeps each picture's own pixel size. Verified.
- Claim: no request-time work, no new CI step and no changeset needed. Verified.
- Claim: the Templates card illustrations are left to a separate change, merged after this branch's base. Verified.
- Claim: no current record governs homepage image files. Verified.
- Claim: nothing looks different and the differences are compression noise. Consistent at display size, apart from a slight upscale of the Matcha and Astryx photos on 3x landscape phones.
- Claim: the docsite build passes. Verified by CI on the previous revision; this revision changes one comment line, and CI deferred its heavy jobs.
- Claim: the phone and desktop timing results, the pixel-difference figures and the encoder settings. Not reproduced.
- File: 26 WebP files under
apps/docsite/public/landing/. Clear: valid WebP, never wider than the source, visually equivalent. - File:
DiscoverShowcase.tsx. Clear. - File:
ThemesPreview.tsx. Finding: the comment at lines 31-32. - File:
HeroFloatingCards.tsx. Clear. - File:
heroThemeContent.ts. Finding: the comment at lines 99-100. - File:
authors.ts. Clear.
The 768-1,023 px collage draws hero photos at up to about 315 px, so a 3x screen needs about 945 device pixels. The hero WebP copies are now at most 960 px wide (a narrower PNG keeps its own width). The themes card comment states the photo size it draws (about 100 px), and the blog README names the avatar size the bylines request.
|
/approve-spec bacc81e |
There was a problem hiding this comment.
Requesting changes. The image swap holds up and the last round's points are fixed, but two statements in the description are still wrong.
- The opening line says the photos were shown "at 11 to 265 px", but the 768 to 1,023 px collage draws the hero photos at about 315 px, as the description's own hero row says, so please change it to "up to about 315 px" or drop the range.
- Miss: "Nothing looks different" does not hold for Discover cards 2 to 4 on screens above 2x, because they draw at 260 px (780 device px at 3x) and the new 560 px copies replace 616 to 816 px sources, so please cut those three at their source width up to 780 px or say that the Discover copies are sized for 2x.
Claims and files checked
- Claim: phone visitors see the main content about 10 seconds sooner (6.3 s instead of 16.1 s). Not reproduced: the author's measurement.
- Claim: the homepage loaded about 19 MB of product photos of 0.5 to 1.6 MB each. Consistent: each photo is 0.54 to 1.65 MB, and the changed PNGs total 17.6 MB of the measured 18.9 MB.
- Claim: those photos were shown at 11 to 265 px. False at the top end: the collage draws them at about 315 px.
- Claim: each image is now served at its display size and nothing looks different. False for Discover cards 2 to 4 above 2x; holds for the hero, Themes and avatar copies at 3x.
- Claim: hero photos become WebP at most 960 px wide (narrower sources keep their width), 12 to 49 KB, shown at up to about 315 px. Verified.
- Claim: the member avatar becomes a 96 px, 2 KB WebP shown at about 20 px. Verified (1.7 KiB, drawn at 19 to 22 px).
- Claim: Themes card photos become 320 px WebP, 8 to 14 KB, shown at about 100 px and sharp at 3x. Verified (drawn at up to 101 px).
- Claim: Discover cards become WebP at most 560 px wide, 9 to 16 KB, shown at 260 px or less. Verified (522 to 560 px, 8.6 to 16.2 KiB).
- Claim: blog byline avatars show at 40 px or less, now ask GitHub for 128 px, and the blog README says so. Verified (20 and 36 px).
- Claim: 19.5 MB of PNGs become 513 KB of WebP. Verified within rounding (19,520 KiB of sources per copy; 511.5 KiB of copies).
- Claim: the 960 px hero copies add 59 KB. Verified (58.8 kB).
- Claim: the reel preloads every slide's photos. Verified (an idle warm-up after mount, fed by the same content map).
- Claim: the original PNGs stay, the themes pages still show the full-size photos, and nothing references the eight named originals. Verified.
- Claim: the docsite uses no image component, already ships pre-sized public files, and its image optimizer keeps each picture's own pixel size. Verified.
- Claim: no request-time work, no new CI step and no changeset needed. Verified.
- Claim: the Templates card illustrations are left to a separate change merged after this branch's base. Verified.
- Claim: no current record governs homepage image files. Verified.
- Claim: the docsite build and typecheck pass. Verified by CI on this revision (build, docsite build and typecheck pass).
- Claim: the timing results, pixel-difference figures and encoder settings. Not reproduced; every copy is no wider than its source.
- File: 26 WebP files under
apps/docsite/public/landing/. Valid WebP, never wider than the source;discover-card-2..4.webpcarry the second finding. - File:
DiscoverShowcase.tsx. Clear apart from the copies it now points at. - File:
ThemesPreview.tsx. Clear. - File:
HeroFloatingCards.tsx. Clear. - File:
heroThemeContent.ts. Clear. - File:
authors.ts. Clear. - File: blog
README.md. Clear.
The desktop discover stage draws each card at 260 px, so a 3x screen needs 780 device pixels. Cards 2-4 are now WebP at their source width up to 780 px (card 1's source is 522 px and keeps it).
|
/approve-spec 949070a |
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet; the first run was cancelled when CI was full, and a new run is in progress. The homepage images now load as WebP copies cut for the size they are drawn at, and both points from the last review are fixed: the description's opening size range, and Discover cards 2 to 4, which are now cut at their source width up to 780 px.
One optional point: the Discover copies drop the PNGs' Display P3 colour profile, so a few pinks and greens on card 4 flatten slightly on wide-gamut screens; keeping the profile in the WebP would avoid that.
Claims and files checked
Claims:
- The homepage loaded about 19 MB of product photos at 0.5 to 1.6 MB each, drawn at up to about 315 px: verified (the hero PNGs are 545 KiB to 1.6 MiB; the tablet collage draws them at up to about 317 px).
- Each image is now served at the size it is shown, and nothing looks different: verified for sharpness at 2x and 3x (every copy covers its drawn size at 3x or keeps its source width); the only colour change is the optional Display P3 point above.
- Phone and desktop timings, and image bytes on arrival and after scrolling: the author's measurements, not reproduced; the footnote's +59 KB and +18 KB deltas and the 1.44 MB sum match the committed files.
- The homepage points at WebP copies under
public/landing/and the original PNGs stay: verified (26 files added, none deleted or moved). - The
/themespages still show the full-size photos: verified (the theme page still uses the unchanged showcase content). - Nothing references the Discover PNGs, the Neutral preview PNGs or the avatar PNG after this change: verified by a repository search (the templates use a different avatar file).
- The per-surface table (widths, byte ranges and drawn sizes for the hero photos, avatar, Themes photos, Discover cards and byline avatars): verified; the avatar draws at 19 to 24 px, which the 96 px copy covers.
- 26 copies total 529 KB of WebP: verified; the "19.5 MB of PNGs" matches the sources without the avatar PNG (19.99 MB with it).
- The docsite has no
next/imageusage, the blog already ships pre-sized WebP files, and no CI step is added: verified. - The Templates card stays out of scope and is served by the image optimizer from a later merge: verified.
- No current record governs homepage image files: verified.
- Screenshot parity of 0.00 to 0.23% per still: the author's measurement; resampled per-image comparisons here show compression noise only.
- The copies are never enlarged: verified; the encoder settings are not checkable.
- The docsite build passes: corroborated by this head's successful preview deployment; CI's build did not run at this head.
- The blog README names the
?size=128default, and no published package changes: verified.
Files:
apps/docsite/src/app/(site)/_landing/hero/heroThemeContent.ts: clear.apps/docsite/src/app/(site)/_landing/hero/HeroFloatingCards.tsx: clear.apps/docsite/src/app/(site)/_landing/ThemesPreview.tsx: clear.apps/docsite/src/app/(site)/_landing/DiscoverShowcase.tsx: clear.apps/docsite/src/content/blog/authors.ts: clear.apps/docsite/src/content/blog/README.md: clear.- 16 hero copies under
apps/docsite/public/landing/hero/: clear. - 6 Themes card copies under
apps/docsite/public/landing/themes/: clear. - 4 Discover copies under
apps/docsite/public/landing/: clear, with the optional colour-profile point.
Primary intent
Phone visitors see the homepage about 10 seconds sooner. The homepage downloaded 19 MB of product photos (0.5 to 1.6 MB PNGs each) and showed them at up to about 315 px. This PR serves each image at the size it is shown. Nothing looks different.
No other template fits: this is a performance change with no visual, behavior or API change.
New public API: none.
User or maintainer impact
apps/docsite/public/landing/. The original PNGs stay in place. The/themespages still show the Butter, Matcha, Gothic and Y2K photos at full size. Nothing referencesdiscover-card-1..4.png,neutral/preview-{watch,headphones,backpack}.pngorimages/avatars/DATA-Ami-Pena.pngafter this change; they stay so their public URLs keep loading.Problem and solution fit
Changes, each one maps to (2):
?size=128asks GitHub for a 128 px imageTotal for the committed copies: 19.5 MB of PNGs become 529 KB of WebP. The docsite has no
next/imagecomponent usage. For images whose paths the docsite owns, it ships pre-sized files inpublic/(the blog's@2xWebP screenshots), so this PR follows that pattern: no work at request time, and each file is cut to its display size (the image optimizer route keeps each picture's own pixel size). It adds no new CI step.Not in this PR: the "Templates" card's six illustration PNGs (3.9 MB in the "after scrolling" numbers below). They come from template sources, which keep their paths; #11320, merged after this branch's base, now serves them through the image optimizer.
Authority
No current record governs homepage image files.
pnpm specs:for --diff origin/mainroutes only global claims (knowledge-contracts source comments, followed here).Change and evidence
Measured at this branch's base (
ccb1e817b14, before #11320) on a production build (next build+next start) served locally, headless Chromium from Playwright (the agent sandbox on this machine blocks a full Chrome launch; same engine), a new cold-cache profile per run, median of 3 runs. Phone: 390x844 at 3x, 4x CPU slowdown, Fast 4G (9 Mbps down, 1.5 Mbps up, 165 ms). Desktop: 1440x900, 4x CPU slowdown, no network throttle. Host 1-minute load average during the runs: 24 to 35 (before) and 15 to 26 (after); the machine is shared, so the time values have noise, byte counts do not.¹ Measured 1.36 MB with the first cut (768 px hero copies, 560 px discover cards). Review asked for sharper copies on 3x screens: 960 px hero copies (+59 KB) and discover cards up to 780 px (+18 KB). Both load on arrival (the reel preloads its photos; the discover images are not lazy), so 1.44 MB. The time values were measured with the first cut.
Visual parity: real-browser screenshots of every changed surface (all 5 reel slides, the themes card, the discover cards, a blog byline) at desktop 1440 (2x) and phone 390 (3x), before and after, with reduced motion so the reel holds still. Pixels that differ by more than 24 in any channel: 0.00 to 0.23% per still (0.51% on the 40 px phone byline avatars). The differences are compression noise.
Desktop hero, Butter slide:

Desktop hero, 1:1 device pixels:

Phone hero cards, Butter and Matcha slides:


Themes card and discover cards, desktop:


The WebP copies were made with sharp: resize to the width above (never enlarged), WebP quality 82, effort 6.
Scope
Components: docsite homepage (hero reel, themes card, discover section), blog byline avatars
Testing
pnpm -F @astryxdesign/docsite build(typecheck included) passes.?size=128avatar default.pnpm specs:for --diff origin/main: global claims only.No changeset: no published package changes.