Skip to main content

Module warmup

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:

Configurationmedian first-paintnotes
no warmup406 msreference
fonts + vello warmup483 msslower than no warmup
fonts warmup only316 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_STRINGS through the supplied FontSystem. Populates the internal shape / fallback caches so the first real draw against the same FontSystem short-circuits at those cache lookups.
spawn_warmup
Spawn a detached background worker that constructs a throw-away FontSystem, shapes CANONICAL_STRINGS against it, then — unless no_vello is set — builds a 4×4 scratch crate::offscreen::OffscreenRenderer and renders one solid-colour scene.