Performance
ANVL apps idle at zero CPU and draw a frame in about a millisecond. These numbers were measured on a desktop with an RTX 3060 Ti and a 279 Hz display, in release builds.
A frame
| Work | Time |
|---|---|
| Building ANVL Note's whole UI (input, layout, widgets) | 0.06 to 0.09 ms |
| Rendering it (glyphs, uploads, encoding, submit) | 0.6 to 0.9 ms |
| 1,200 interactive elements: layout, input and paint | about 2.9 ms |
| Idle | no frames, no CPU |
Animations run at the display's refresh rate. ANVL Note ran at 279 to 282 fps on a 279 Hz display, including while its window was being moved.
Memory
| Part | Working set |
|---|---|
| The GPU driver (an empty DirectX 12 device on NVIDIA) | about 88 MB |
| ANVL's own CPU side: fonts, icons, text | about 9 MB |
| ANVL Note, in a window, after its first frames | about 120 MB |
Most of an app's memory is the graphics driver, which every GPU app pays. Intel and AMD drivers are usually lighter than NVIDIA's.
Measuring your app
renderer.timings()after each frame gives the time spent waiting for the display and the renderer's own work. ANVL Note prints it once a second withANVIL_NOTE_BENCH=1; copy that into your app.cargo run --release -p anvil_ui --example mem_probeprints memory after each startup step.cargo run --release -p anvl_gpu --example bare_deviceprints your GPU driver's floor, for comparison.
Rules of thumb
- Let it sleep. Ask for a redraw when something changed, not on a timer.
ui.next_wake()already covers animations, blinking carets and toasts. - Do slow work off the UI thread and send the result with the
Proxy. A frame should never wait on disk or the network. - Upload pictures once. Keep the
TextureId; draw it every frame for free. - Give list items ids, so their state follows them, and keep very long lists to what is on screen.
- Use theme tokens: a theme change then costs nothing.
- Build in release to measure. Debug builds turn on GPU validation, which is slower and uses far more memory.