6 ex_gui_bench_8c example
gullradriel edited this page 2026-10-09 00:55:18 +02:00

ex_gui_bench.c

Headless-friendly performance benchmark for the n_gui system. Builds one heavy, representative context (a large datagrid, a multiline textarea, a JSON syntax view, list widgets and many static labels/buttons) and times two hot paths in isolation:

It renders to the display back buffer without flipping, so the number reflects the CPU cost of building the frame (text measurement, tokenization, primitive submission) rather than vsync/present latency. This is the metric the GUI optimisation work targets, and it is reproducible under Xvfb.

Not a correctness regression: like the other ex_gui_* programs it is excluded from run_tests.sh. Run it manually (optionally under xvfb-run) before and after an optimisation to compare numbers. It self-terminates and frees every resource, so it is also an ASan/LSan smoke test of the draw + teardown path.