Skip to main content

Module warmup

Module warmup 

Expand description

Cold-start warmup of the font system.

Loading the font system dominates time-to-first-paint on a cold process: the catalog is verified and every installed face mapped, up to ~1s on release builds. Shaping the first text on a background thread, before the first frame needs it, takes that off the critical path:

Configurationmedian first-paint
no warmup406 ms
fonts warmup316 ms

It 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. Building the renderer’s pipelines here instead was measured slower (483 ms): it holds the process-wide SHARED_RENDER_CONTEXT mutex through its scratch render, blocking the real renderer’s start on the same lock, so it is not done.

The stages mark through [tilo_startup_metrics::span]: warmup-spawn, warmup-fonts(-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§

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 builds the process’s shared FontSystem and shapes CANONICAL_STRINGS against it, so the fonts the first frame needs are read and mapped beside the rest of the start.