Skip to content

perf(playground): preload the initial sans font#5

Merged
wiyco merged 1 commit into
mainfrom
perf/playground-preload-initial-font
Jun 4, 2026
Merged

perf(playground): preload the initial sans font#5
wiyco merged 1 commit into
mainfrom
perf/playground-preload-initial-font

Conversation

@wiyco

@wiyco wiyco commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Preload the emitted GeistVariableLatin-*.woff2 asset in generated playground HTML.
  • Resolve the Vite hashed font asset at build-output time, including the correct relative URL for nested pages.
  • Keep the mono font out of the initial preload path and allow disabling the preload with SVGO_PRELOAD_INITIAL_FONT=0 for A/B checks.

Validation

  • pnpm run check:fix
  • pnpm run test:coverage
  • pnpm --filter ./apps/playground typecheck
  • pnpm vitest run apps/playground/src/build/preload-font-build-output.test.ts apps/playground/src/entries/entrypoints.test.tsx
  • pnpm --filter ./apps/playground build

Notes

Local preview timing showed the sans font request moving from a CSS-initiated start around 46.5ms to a link-initiated start around 10.6ms. I kept font-display: block unchanged: the swap check did not show a meaningful paint improvement after preload, and delayed-font checks showed visible text metric changes that could surface as FOUT.

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

Code Metrics Report

Download coverage report: lcov-report

main (441a7a4) #5 (7e711ed) +/-
Coverage 100.0% 100.0% 0.0%
Code to Test Ratio 1:1.8 1:1.8 -0.1
Test Execution Time 1s 1s 0s
Details
  |                     | main (441a7a4) | #5 (7e711ed) | +/-  |
  |---------------------|----------------|--------------|------|
  | Coverage            |         100.0% |       100.0% | 0.0% |
  |   Files             |             63 |           64 |   +1 |
  |   Lines             |           1323 |         1358 |  +35 |
+ |   Covered           |           1323 |         1358 |  +35 |
- | Code to Test Ratio  |          1:1.8 |        1:1.8 | -0.1 |
  |   Code              |           4265 |         4356 |  +91 |
+ |   Test              |           7948 |         8080 | +132 |
  | Test Execution Time |             1s |           1s |   0s |

Code coverage of files in pull request scope (0.0% → 100.0%)

Files Coverage +/- Status
apps/playground/src/build/preload-font-build-output.ts 100.0% +100.0% added

Reported by octocov

@wiyco wiyco merged commit 768f512 into main Jun 4, 2026
4 checks passed
@wiyco wiyco deleted the perf/playground-preload-initial-font branch June 4, 2026 22:14
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