Module warmup
Expand description
Cold-start warmup for expensive first-frame work.
Two things dominate time-to-first-paint on a cold process: loading the
font system (verifying the font catalog and mapping every installed face,
up to ~1s on release builds), and vello::Renderer::new(), which compiles
~30 WGSL pipelines against the live wgpu device, stalling whichever thread
runs it. Only the fonts side ships enabled by default:
| Configuration | median first-paint | notes |
|---|---|---|
| no warmup | 406 ms | reference |
| fonts + vello warmup | 483 ms | slower than no warmup |
| fonts warmup only | 316 ms | -90 ms / -22 % |
Vello regresses because it holds the process-wide SHARED_RENDER_CONTEXT
mutex through its scratch render, blocking main’s OffscreenRenderer::new
on the same lock — left opt-in behind TILO_STARTUP_WARM_VELLO. Fonts
wins because it never touches the GPU: it shapes strings on a background
thread, building the process’s shared font database so the compositor’s own
configured_font_system call finds it ready.
TILO_STARTUP_WARM=off (also 0/false/no) disables warmup for A/B
measurement. Stages mark through [tilo_startup_metrics::span]:
warmup-spawn, warmup-fonts(-end), warmup-vello(-end).
Not persistence: compiled pipelines are kept across launches by
crate::pipeline_cache (the app’s own) and crate::pipeline_seed (the
session’s), where the backend has pipeline caches.
Modules§
- _cosmic_
text - COSMIC Text
Constants§
- CANONICAL_
STRINGS - Canonical strings the warmup shapes through cosmic-text so the per-face shaping caches are populated before the compositor’s first real widget draw. Kept small so the warmup thread stays under ~50ms wall time even on a cold fontconfig cache.
Functions§
- is_
enabled - Whether warmup should run in the current process.
- shape_
canonical_ strings - Shape every entry of
CANONICAL_STRINGSthrough the suppliedFontSystem. Populates the internal shape / fallback caches so the first real draw against the sameFontSystemshort-circuits at those cache lookups. - spawn_
warmup - Spawn a detached background worker that constructs a throw-away
FontSystem, shapesCANONICAL_STRINGSagainst it, then — unlessno_vellois set — builds a 4×4 scratchcrate::offscreen::OffscreenRendererand renders one solid-colour scene.