Skip to content

Performance

How ImmyGo spends CPU, how it compares with GPUI, and how to keep your own app fast.

How ImmyGo renders

  • On the GPU. ImmyGo draws through Gio, which renders every shape and glyph as vector paths on the GPU (Vulkan, Metal, Direct3D, OpenGL ES or WebGL, depending on the platform).
  • On demand. ui.Run draws a frame only when something changes: input, a widget animation, State.Set / State.Update, a theme switch, or ui.Invalidate(). An idle window draws nothing.
  • With reuse. Shapes that do not change between frames (card surfaces, borders, shadows, icons) are recorded once and reused, so the GPU geometry for them is built once.

ImmyGo and GPUI

The same four-scene app was written once with ImmyGo and once with GPUI, each using its framework in the ordinary way, with identical built-in telemetry.

Scene What it does
dashboard 8 line charts of 600 samples, redrawn every frame, plus 16 numeric readouts that change every frame
grid 100,000 rows × 6 columns, virtualized, scrolling two rows per frame
churn 1,200 small coloured cells with a number each; 120 change value and colour per frame
idle a static screen where one label changes once per second

Results

Medians of three runs.

Metric ImmyGo GPUI
Startup to first frame 76 ms 128 ms
Binary size 13.4 MB 27.6 MB
Peak memory (RSS) 207 MB 170 MB
dashboard: frames per second 60.0 60.0
dashboard: CPU per frame 3.80 ms 2.41 ms
dashboard: frame interval p99 17.6 ms 16.9 ms
grid: frames per second 60.0 60.0
grid: CPU per frame 1.62 ms 1.09 ms
grid: frame interval p99 17.3 ms 17.1 ms
churn: frames per second 60.0 60.0
churn: CPU per frame 9.17 ms 4.27 ms
churn: frame interval p99 18.2 ms 16.8 ms
idle: frames per second 1.0 1.0
idle: CPU load (one core) 0.2% 0.4%

Neither framework dropped a frame in any scene.

Setup

  • Intel Core i5-12600KF, Linux 6.17, X11 session, 60 Hz display.
  • ImmyGo at the commit that adds the reference report (Gio v0.10.3, Go 1.26.2). GPUI from zed-industries/zed@bbe8099 (Rust 1.100.0, as pinned by gpui-app/rust-toolchain.toml).
  • Each scene ran 12 seconds; the first 2 were not measured.
  • CPU is process CPU time from getrusage (all threads), divided by frames or by wall time. GPU time is not measured.
  • The benchmark is in benchmarks/uibench: both apps, the runner script and the unedited report these figures come from. Run ./run.sh there to reproduce them on your own hardware.

Reading the numbers

  • Where ImmyGo is ahead: startup, binary size, build time and idle cost.
  • Where GPUI is ahead: CPU per animated frame (1.5× to 2.1× less) and memory. GPUI batches drawing into far fewer GPU calls; Gio issues one per shape and per text label. GPUI also uses subpixel text antialiasing, so its text looks crisper on standard-density displays; Gio’s text is greyscale-antialiased.
  • What it means in practice: both hold 60 fps with room to spare on this machine. The per-frame gap matters most for screens that redraw hundreds of shapes every frame; for ordinary apps, which redraw on input, the idle and startup figures matter more.

Build time

ImmyGo GPUI
Release build of the benchmark app, as reported by the benchmark script 1–6 s 74–110 s

These are the three runs on the benchmark machine in which the benchmark was built in a fresh directory, with dependency sources already downloaded: ImmyGo took 6 s, 1 s and 1 s; GPUI took 74 s, 88 s and 110 s.

This is not a cold-against-cold comparison, and it reflects how the two toolchains behave rather than a tuned measurement. Go keeps compiled packages in a machine-wide cache, so a fresh checkout reuses the framework it has already compiled. Cargo compiles dependencies per project, so a fresh checkout compiles GPUI again. ImmyGo’s build from a truly empty cache is in the table below.

Measured separately for ImmyGo on a 4-core cloud VM:

Build Time
First build from an empty Go build cache (examples/ui-hello) 24 s
Rebuild after editing the app (examples/ui-showcase) 1.6 s
Rebuild after editing the framework’s ui package 2.2 s

Keeping your app fast

  • Check what you draw. Run with IMMYGO_FRAMESTATS=1 to print frames drawn per second. An idle app should print 0.
  • Tell ImmyGo when background work finishes. Change shared data through ui.State, or hand a goroutine’s result to the UI with ui.Post(func() { ... }), which redraws once it has run.
  • Keep State changes out of the build function. Each one asks for another frame, so the window redraws continuously. IMMYGO_DEBUG=1 warns when this happens frame after frame.
  • Give large grids a height. ui.DataGrid lays out only the rows in view, but inside a scroll container it sees unlimited space and lays out every row. Use .Height(...) or ui.Flex(1, grid).
  • Use ui.Polyline for live lines. Stroking a path yourself with Gio’s clip.Stroke inside a ui.ViewFunc runs a general-purpose stroker on the CPU every frame. On the dashboard scene, switching the charts to ui.Polyline and caching the card shapes cut CPU per frame from 8.7 ms to 3.9 ms.
  • Keep text variety bounded on busy screens. Gio caches text layout and glyph paths for about 1,000 distinct strings. A screen that shows more than that many different strings every frame re-shapes text continuously.

Benchmarks in this repository

Terminal window
go test ./ui -run '^$' -bench . -benchmem # build + layout of a frame, no window
go test ./widget -run '^$' -bench . -benchmem # data grid and polyline

These measure ImmyGo’s own build-and-layout work. They do not include Gio’s rendering, which is the larger share of a frame.