Performance
What CPUI measures, the budgets it holds itself to, and measurements of other Rust UI frameworks running the same program. All numbers come from one machine: an Apple M4 Pro with 24 GB of memory, release builds, at a scale factor of 2.
Budgets
Section titled “Budgets”A budget is an upper limit for a measurement. The items below are measured by cpui-bench, the
benchmark in this repository. Exceeding a budget is treated as a bug.
Frame times are measured offscreen, without a window. Each run yields a p95: the time that 95% of its frames stay under. “Typical” is the median p95 of 20 runs and “worst” is the largest. The budget is twice the worst value, rounded up.
| Frame, p95 | Typical | Worst | Budget |
|---|---|---|---|
| Idle, 800×600 | 0.005 ms | 0.008 ms | 0.02 ms |
| Hover, 800×600 | 0.015 ms | 0.024 ms | 0.05 ms |
| Typing, 800×600 | 0.077 ms | 0.094 ms | 0.20 ms |
| Full frame, 800×600 | 0.098 ms | 0.122 ms | 0.25 ms |
| Full frame of Arabic text, 800×600 | 0.235 ms | 0.255 ms | 0.55 ms |
| Scrolling a 100,000-row list, 800×600 | 0.192 ms | 0.235 ms | 0.50 ms |
| Scrolling a tree of 10,000 items, 800×600 | 1.087 ms | 1.129 ms | 2.30 ms |
| A select of 1,000 options, open, 800×600 | 0.052 ms | 0.055 ms | 0.12 ms |
| Typing in a 10,000-line text input, 800×600 | 0.932 ms | 1.051 ms | 2.25 ms |
| Scrolling the list, 6K full screen | 0.516 ms | 0.617 ms | 1.25 ms |
| Full frame of the list, 6K full screen | 0.545 ms | 0.652 ms | 1.35 ms |
Items that need a real window are measured on macOS:
| Window | Measured | Budget |
|---|---|---|
| Memory while idle, 800×600 and visible | 27 MB | ≤ 30 MB |
| Frames drawn in 5 idle seconds | 0 | 0 |
| CPU time in 5 idle seconds | 0–20 ms | ≤ 30 ms |
| Peak memory in the first 2 seconds | 27.4–29.6 MB | ≤ 30 MB |
Time from run to the window appearing |
56–90 ms | ≤ 100 ms |
Size of the hello executable |
2.0 MB | ≤ 2.5 MB |
Window measurements are valid only when the window stays in front and receives no pointer or keyboard input during startup. The benchmark flags runs that were disturbed or covered.
Where the memory goes
Section titled “Where the memory goes”An AppKit program that only opens a system window and draws nothing uses 19 MB. An idle 800×600 CPUI window adds about 8 MB:
- 7.5 MB is one presentation buffer, the image handed to the window (800×600 at 2×, 4 bytes per pixel). A CPU renderer needs at least this buffer while the window is visible.
- The rest is heap, of which CPUI allocates about 0.7 MB, including 0.3 MB of glyph cache.
Presentation buffers are returned to the system while the window is idle, unfocused or covered. While the pointer moves over the window, the window is redrawn continuously and holds two more buffers; the peak is about 43 MB.
Compared with other frameworks
Section titled “Compared with other frameworks”Measured on 2026-11-28. Each framework runs the same program: a line of Chinese text, a counter button and a text input. GPUI ships no text input, so its program uses the one from GPUI’s own examples.
- Memory is the
phys_footprintreported byfootprint, which is the Memory column of Activity Monitor and includes GPU memory. It was sampled once per second for 10 seconds. The tables give the median, with the maximum in parentheses. - CPU per frame is the process’s CPU time between the 2nd and the 10th second divided by the number of frames. The counter changes on every frame during that interval.
- Each configuration ran three times, alternating with the others. The tables give the range of the three runs.
800×600 window on the built-in display, at 120 Hz:
| Rendering | Memory, idle | Memory, redrawing | CPU per frame | |
|---|---|---|---|---|
| CPUI 0.1.0 | CPU | 28 MB (28) | 43 MB | 0.30–0.36 ms |
| iced 0.14, tiny-skia | CPU | 52–53 MB | 52–60 MB (67) | 4.2 ms at 240 frames per second, one core saturated |
| Slint 1.19, software | CPU | 52 MB | 52 MB (59) | not obtained, 54–55% CPU |
| Slint 1.19, femtovg | GPU | 75–76 MB (192) | 196–199 MB | 0.66–0.71 ms |
| Rune, development version | Metal | 50–51 MB (256) | 263–264 MB | 1.06–1.37 ms |
| iced 0.14, wgpu | GPU | 44–45 MB (239) | 239–240 MB | 1.07–1.68 ms |
| egui 0.37, wgpu | GPU | 68–71 MB (273) | 266–272 MB (279) | 1.35–1.44 ms |
| GPUI 0.2.2 | Metal | 52 MB (166) | 166–167 MB | 2.02–2.16 ms |
Full screen on a 5120×2880 display at 60 Hz, where the system limited every window to 2316×1410 logical pixels:
| Memory, idle | Memory, redrawing | Frames per second | CPU per frame | |
|---|---|---|---|---|
| CPUI | 69–70 MB (70) | 167 MB (168) | 60 | 0.46–1.03 ms |
| iced, tiny-skia | 228 MB | 228–277 MB (306) | 38.5 | 26.0 ms, one core saturated |
| Slint, software | 202–218 MB | 218 MB (266) | not obtained | not obtained, 98% CPU |
| Slint, femtovg | 325–326 MB (442) | 491 MB | 60 | 1.52–1.59 ms |
| Rune | 190 MB (399) | 396–445 MB | 60 | 1.72–1.95 ms |
| egui, wgpu | 164–235 MB (440) | 388–393 MB (410) | 60 | 1.78–1.80 ms |
| iced, wgpu | 141–142 MB (337) | 353 MB (356) | 60 | 1.84–2.17 ms |
| GPUI | 143–193 MB (308) | 258–308 MB | 60 | 3.01–3.16 ms |
What the comparison does not show
Section titled “What the comparison does not show”- The programs are simple and change one piece of text per frame. This favors a framework that redraws only what changed, as CPUI does. For the cost of a frame that changes entirely, see the budget table above; it is measured offscreen and excludes presentation to the window.
- CPU per frame counts only the application’s own process. Work done by the GPU and by the window server is not included, which leaves out part of the cost of the GPU renderers.
- iced’s tiny-skia backend is not limited to the display’s refresh rate, so it drew more frames than the others in the same time.
- Slint’s software backend has no render callback, so its frame rate and CPU per frame were not obtained; its program changes the counter on a 4 ms timer instead.
- Rune has no released version; the measurement used commit
86df731b7of its development branch. GPUI compiled its shaders when the program started, which affects only startup. - One full-screen run of Slint femtovg was discarded because the system moved its window to the other display.
- All measurements come from one machine. The measurement scripts and the programs for the other frameworks are not in this repository, so the comparison cannot be reproduced from it.
Finding unnecessary redraws
Section titled “Finding unnecessary redraws”Set CPUI_TRACE=1 to write window events and every frame to standard error. An idle window
writes nothing.