Performance and benchmarks
Learn the budget Ljós holds itself to (0 % CPU at rest, every
frame within 16.7 ms, memory that fits a small board), how ljos
bench measures it, and how to keep your application inside it.
This page explains the budget Ljós holds itself to, how
ljos bench measures an application against it from outside the process, what the reported memory, startup and frame numbers mean, and how to write QML that stays within it.At rest, 0 % CPU. Nothing polls. The UI thread sleeps until input, a running timer or animation, a message or the windowing system wakes it, so an app that is not doing anything costs nothing.
Every frame within 16.7 ms (
limits::motion::FRAME_BUDGET_MS). Frames are scheduled only when something changed, and only what changed is drawn again.Fast to start, light on memory. The
pi-zero profile below holds an application to a 1 GHz quad-core board with roughly 256 MB to spare. It is a stress test: what fits there is quick and light everywhere else.Faster and lighter than the reference. The same QML is measured on Ljós and on Qt (
qml6), the runtime most existing QML was written for, and Ljós aims to start sooner, lag less and use less memory. The comparison runs below show where it stands.To measure against that budget, the benchmark suite runs the same QML applications—both synthetic workloads in
bench/*.qml and examples from the Qt documentation corpus—on Ljós (ljos run) and on Qt (qml6). Both runtimes run inside a transient systemd-run --user --scope cgroup on a headless Wayland compositor (sway in scripts/cua-sandbox.sh) with QT_QUICK_CONTROLS_STYLE=Basic.By default,
mise run bench passes --warm-up --repeat 3 --bisect pi-zero (configurable via BENCH_DEFAULTS) and writes its output to target/bench/ (or $BENCH_DIR):report.json: raw measurements and thread CPU breakdowns (thread_cpu_ms) for every repeat.report.md: median summary tables.work/: per-application logs and outputs.For long runs, pass
--append to add results incrementally to an existing report.json:Every measurement is read from outside the application using cgroup accounting,
/proc, and the Wayland compositor's screencopy interface. If a required cgroup controller (memory or cpu) is not delegated, ljos bench exits with status 2 rather than reporting unthrottled numbers.The
pi-zero profile models a Raspberry Pi Zero 2 W (four Cortex-A53 cores at 1 GHz and 512 MB of RAM, with roughly half available to the application after the OS and compositor). Counting the quota over a 10 ms period stalls a throttled app for a few milliseconds at a time, like a slow core, rather than for most of a 100 ms window.Because Linux cgroups charge shared pages to whichever cgroup faulted them in first,
--warm-up loads shared libraries into the page cache before measurement starts. Treat least memory as what the application needs on top of a system that already has its runtime libraries loaded; on a single-app embedded board, add the mapped install size.Measured on
bench/rectangles.qml (release build on the sandbox's headless sway with pixman), wall-clock time from process start breaks down as follows:Graphics driver initialisation dominates startup. With the default EGL painter (
egui_glow), Ljós starts only the EGL display on a background thread as soon as the Wayland display opens, without creating a wgpu instance. On a machine where an unused NVIDIA Vulkan driver was installed alongside a Radeon GPU, restricting VK_DRIVER_FILES to the Radeon driver brought Ljós's time to first frame from about 550 ms down to 85–115 ms (compared with 110–205 ms on Qt). Since 2026-10-18, Ljós automatically skips NVIDIA's Vulkan ICD and EGL vendor when the NVIDIA kernel module is not loaded.Measured on 2026-10-15 on an AMD Ryzen AI Max+ 395 (32 CPUs, 63 GiB RAM, Linux 7.2, machine load average 3.5 to 143) across 25 applications (the 5
bench/*.qml apps and 20 runnable corpus examples), comparing Ljós (419a04c, --release with thin LTO; animations at ecda6d6) against Qt 6.11.2. Values below ×1.00 mean Ljós used less time or memory than Qt:Least memory (
pi-zero): Ljós needed 54–58 MiB for small examples and 68–101 MiB for larger ones, compared with 92–123 MiB for Qt. The one exception was rssnews, which decoded feed images at full resolution and required 271 MiB on Ljós versus 135 MiB on Qt (both were OOM-killed under the 256 MiB limit).Idle CPU: 0 % on both Ljós and Qt for all applications that do not animate.
On 2026-10-16, profiling
bench/animations.qml on software rasterisation (llvmpipe over wgpu GL) showed that building the frame took 0.1–0.5 ms, tessellating 0.02 ms, and submitting 1.1 ms, while llvmpipe raster threads used ~80 % of a core painting three full-window quads (clear, backdrop, and root Rectangle). Skipping presentation when nothing changed, omitting the redundant backdrop clear, and promoting an opaque root rectangle to the clear colour produced the following before → after results (measured on 2026-10-16, load average 37–68):To eliminate the remaining ~27 % fixed per-frame overhead of
wgpu's offscreen GL copy, Ljós introduced a direct EGL painter (egui_glow, 2026-10-16) that draws directly into the window buffer, turns opaque axis-aligned rectangles into scissored clears, and uses EGL buffer age to redraw only damaged regions (in bench/animations.qml, 200 moving bars touch only 11,500 of the window's 1.92 million pixels per frame).Ljós schedules frames only on demand—when state becomes dirty, or when an animation, timer, or input event fires—and pulls render-only bindings lazily. Follow these rules in your QML code to keep idle CPU at 0 % and active animations under the 16.7 ms frame budget (
limits::motion::FRAME_BUDGET_MS):1.
Use declarative animations instead of
Timer (motion-timer-driven): Never step x, y, or opacity from a 16 ms repeating Timer. A repeating timer wakes the CPU on every tick, bypasses the animation clock, and ignores reduced motion.2.
Bind
running on infinite animations (motion-endless): Any SequentialAnimation or NumberAnimation with loops: Animation.Infinite must bind running to the state it represents (such as running: syncing && visible) so the engine sleeps at 0 % CPU when the state ends.3.
Hide off-screen panes with
visible: false (a11y-hidden-exposed): Setting opacity: 0 leaves an item in the accessibility tree. Binding visible: opacity > 0 removes hidden items from both the accessibility tree and rendering work.4.
Animate compositor-cheap properties (
motion-layout-property and motion-dropped-frames): Animate x, y, scale, rotation, and opacity. Never animate width, height, implicitHeight, or anchor margins, which relayout the scene on every frame.5.
Virtualise lists with
ListView: Use ListView rather than Repeater inside a Column so delegates, text layouts, glyph runs, and textures exist only near the viewport.To inspect where Rust heap memory goes inside Ljós, build
ljos_cli with the dhat-heap feature and summarise the output by subsystem:
