benchmarks/

directory
v1.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2026 License: BSD-3-Clause

README

Benchmarks

The apps and scripts behind docs/BENCHMARKS.md, so that anyone can run the comparisons again. Two comparisons live here:

  • ui/: the 2D comparison. One app with the same three scenes, written for Glutter (ui/glutter), Flutter (ui/flutter), egui (ui/egui), iced (ui/iced), gpui (ui/gpui) and GTK 4 (ui/gtk), and the scripts that build, run and measure them.
  • threejs/: the 3D comparison with three.js in headless Chromium, on WebGL 2 and WebGPU. A Glutter page (threejs/app), the three.js page that draws the same scenes (threejs/page/three.html), and the driver that loads them (threejs/driver).

Nothing of the other toolkits is a dependency of the Glutter module: go build ./... builds only the two Glutter apps and the driver. The other apps are built by their own tools from the sources here.

Where things go

Everything the scripts fetch or build goes into one folder outside the repository, BENCH_WORK (${XDG_CACHE_HOME:-$HOME/.cache}/glutter-bench unless you set it; env.sh has the paths): the Flutter SDK with its home and caches, the caches and build folders of cargo (CARGO_HOME and CARGO_TARGET_DIR point there), the three.js package, the binaries, the logs of the runs, the profiles and the screenshots. Delete it to start again.

What each needs

App Needs Fetched by
Glutter Go (the version of go.mod) nothing to fetch
GTK 4 gcc and the GTK 4 library (the runtime package is enough: build.sh links against the library itself) nothing to fetch
egui 0.38, iced 0.14, gpui 0.2.2 Rust with cargo (edition 2024), the Wayland and xkbcommon libraries ui/fetch.sh egui iced gpui: the crates of the lock files
Flutter 3.50.2 git, and what flutter build linux needs: clang, cmake, ninja, pkg-config and the GTK 3 development files ui/fetch.sh flutter: a shallow clone of the SDK at the release tag, and flutter precache --linux; for ui/web.sh also flutter precache --web
The other platforms (ui/web.sh, ui/wine.sh, ui/android.sh) Chromium; Wine and Xvfb; the Android SDK and NDK with the emulator image of the device tests (ANDROID_HOME) nothing more
three.js 0.187.0 curl; Chromium for the run (internal/webtest finds it) threejs/fetch.sh: the three package of npm

The runs of the 2D comparison need sway and grim (scripts/headless-wayland.sh starts a headless sway, so nothing appears on your desktop). On a machine with more than one GPU, choose one with MESA_VK_DEVICE_SELECT (for example MESA_VK_DEVICE_SELECT='1002:1681!') or DRI_PRIME: the numbers of docs/BENCHMARKS.md are of a Radeon 680M.

The Flutter app is a project that flutter create --platforms=linux makes in BENCH_WORK/flutter-app (ui/web.sh adds the web), with ui/flutter/lib/*.dart (main.dart, and host_io.dart and host_web.dart, what its meter reads of Linux and of a page), pubspec.yaml and pubspec.lock copied in and one line of its runner changed (the window is 1280x800, as the others are); its tests are removed. Nothing else of the generated project matters.

The 2D comparison

benchmarks/ui/fetch.sh                      # once: the crates and the Flutter SDK
benchmarks/ui/build.sh                      # glutter gtk egui iced gpui flutter
benchmarks/ui/build.sh "glutter glutter@v1.19.0"   # this checkout beside a release (a ref's slashes become dashes in the binary's name)
benchmarks/ui/run.sh 4 3 "glutter flutter egui iced gpui gtk" "cells scroll static" | tee results.txt
benchmarks/ui/summary.py results.txt

run.sh <secs> <runs> <apps> <scenes> runs one app at a time in one headless sway at HZ frames a second (60 by default; 1000 to see how fast an app can go). Each app draws for 2 seconds of warm-up, then measures for <secs> seconds and prints one line, which run.sh puts after its name and scene:

glutter cells RESULT fps=59.8 cpu_ms=18.140 rss_mb=109 first_ms=77 p50_ms=16.67 p99_ms=17.52 max_ms=19.03
  • fps: the frames a second it drew.
  • cpu_ms: the CPU time of the whole process (every thread, user and system) for a frame. This is the number of the tables.
  • rss_mb: the resident memory of the process at the end.
  • first_ms: from the moment the script started the process (START_NS) to the app's first frame.
  • p50_ms, p99_ms, max_ms: the median, the 99th percentile (by the nearest rank) and the longest time between two frames. Glutter and Flutter take the times at which their frames were presented (FrameTiming's raster finish), GTK those of its frame clock, egui, iced and gpui those of the calls that build a frame (they give no time of presentation). At 60 frames a second a frame that came late shows in p99_ms and max_ms, where the averages hide it.

The scenes, the same in every app:

Scene What it draws
cells 40 rows of 12 texts, such as "r12 c5 3471", that all change at every frame
scroll a list of 10,000 rows (a colored square and two lines of text) that scrolls by 7 pixels a frame
static 2,000 short texts that do not change, below a bar whose width changes at every frame
staticrb the same, with the bar in a RepaintBoundary (Glutter and Flutter only)
empty the bar alone: the memory of a window with next to nothing in it (Glutter only)

The Glutter app takes its scene from its first argument or from GLUTTER_BENCH_SCENE, and its other settings from GLUTTER_BENCH_SECS, GLUTTER_BENCH_START_NS, GLUTTER_BENCH_CPUPROF (a CPU profile of the measured part) and GLUTTER_BENCH_MEMPROF (a heap profile of the end of the run, after a collection, sampled every 4 KB), GLUTTER_BENCH_MEMREPORT (lines MEM ... at the end: the Go runtime's account of its memory and the resident memory of each mapping of the process) or the same names without the prefix, so that it also runs where there are no arguments: on the web (go run ./cmd/glutter-web serve ./benchmarks/ui/glutter, then ?GLUTTER_BENCH_SCENE=scroll), under Wine (go run ./cmd/glutter-windows run ./benchmarks/ui/glutter) and on Android (go run ./cmd/glutter-android run ./benchmarks/ui/glutter, with the variables given by the tool). It measures CPU time and memory only where /proc has them (Linux and Android); elsewhere those are 0 and the frame times are the measure.

More scripts:

  • profile.sh [app] [scenes]: a CPU profile of the measured part of each scene of the Glutter app, into BENCH_WORK/profile-<app>-<scene> (go tool pprof -top BENCH_WORK/bin/glutter BENCH_WORK/profile-glutter-cells).
  • threads.sh [app] [scenes]: the CPU time of each thread of an app, the six busiest (Flutter by default, whose threads are named).
  • shots.sh <apps> <scenes>: a screenshot of each app, to see that all draw the same.

The 2D scenes on the other platforms

The Glutter app of the 2D comparison runs on every platform; three scripts build it and run its scenes there, and print the lines that summary.py reads (step 72.7):

benchmarks/ui/web.sh 4 3 "glutter@v1.19.0 glutter flutter"   # headless Chromium: WebGPU and WebGL 2, and Flutter's web build
benchmarks/ui/wine.sh 4 3 "glutter@v1.19.0 glutter"          # under Wine: Direct3D 12 on vkd3d and lavapipe
benchmarks/ui/android.sh 4 3 "glutter@v1.19.0 glutter"       # the Android emulator: Vulkan and OpenGL ES on SwiftShader
  • web.sh builds each app's site into BENCH_WORK/web (glutter-web build, of that version for glutter@<ref>; Flutter's flutter build web of ui/flutter, whose host_web.dart reads the scene from the page's query) and runs ui/web, which loads each page in headless Chromium at 1280x800 and waits for its RESULT line. The browser draws as many frames as it can (--disable-frame-rate-limit --disable-gpu-vsync), so fps is the frames a second without a limit; a page has no CPU time or memory of a process (0). RENDERERS chooses the renderers of the Glutter app (webgpu,webgl).
  • wine.sh builds each version's console program with its own glutter-windows into BENCH_WORK/wine and runs it with scripts/wine-exec.sh. These are Wine's numbers on a CPU rasterizer: for noticing a regression between versions, not for a PC.
  • android.sh builds each version's APK with its own glutter-android (a release build for amd64, signed with a debug key in BENCH_WORK/xdg) and runs ui/android, which starts the emulator of the device tests (internal/androidtest), installs each APK in turn and reads the RESULT line from the app's log. RENDERERS chooses the renderers (vulkan,gles). Needs ANDROID_HOME.

SCENES chooses the scenes of all three.

The 3D comparison

benchmarks/threejs/fetch.sh                 # once: three.js
benchmarks/threejs/run.sh 3 3               # 3 runs of 3 seconds of every scene, kind and API
SCENES=moving KINDS=glutter,three-best APIS=webgpu benchmarks/threejs/run.sh 3 3

The driver builds threejs/app for the web, copies the three.js page and library beside it and loads each page in headless Chromium, one at a time, the runs interleaved; the Glutter page of a scene runs first and gives its camera to the three.js pages, so that both draw the same thing. Each page draws into a target of 1920x1080 with 4x multisampling and posts the frames a second, the CPU time of a frame and a picture (in BENCH_WORK/threejs). The scenes: terrace (one mesh of 1,002,528 triangles), shared (10,000 items of one mesh), separate (10,000 items of 10,000 meshes) and moving (10,000 objects of one mesh that all move, with viewport3d.Instances). The kinds: glutter, three (a Mesh for each object) and three-best (InstancedMesh, or BatchedMesh for meshes of their own).

Reading the numbers

They are of one machine, so read them as ratios. A laptop's power mode changes them a lot (the numbers of 1.19 were taken in the low-power mode). Close other programs, run every app in the same session, and take the median of three runs or more.

Directories

Path Synopsis
threejs
app command
The Glutter app of the 3D comparison of docs/BENCHMARKS.md, which the driver (../driver) builds for the web and loads beside the three.js page (../page): it opens the device of the renderer the query asks for (?api=webgl or webgpu), draws the scene of the query (terrace, shared, separate, moving, onebox) into a target of 1920x1080 with 4x multisampling for secs seconds, with at most q frames in flight, and posts the frames a second, the CPU time of a frame and a picture.
The Glutter app of the 3D comparison of docs/BENCHMARKS.md, which the driver (../driver) builds for the web and loads beside the three.js page (../page): it opens the device of the renderer the query asks for (?api=webgl or webgpu), draws the scene of the query (terrace, shared, separate, moving, onebox) into a target of 1920x1080 with 4x multisampling for secs seconds, with at most q frames in flight, and posts the frames a second, the CPU time of a frame and a picture.
driver command
The driver of the 3D comparison of docs/BENCHMARKS.md: it builds the Glutter app (../app) for the web, copies the three.js page and library beside it, and loads each page in headless Chromium, one at a time, the runs interleaved.
The driver of the 3D comparison of docs/BENCHMARKS.md: it builds the Glutter app (../app) for the web, copies the three.js page and library beside it, and loads each page in headless Chromium, one at a time, the runs interleaved.
ui
android command
The driver of the 2D comparison on the Android emulator (../android.sh builds the APKs and runs it): it starts the emulator of the device tests (internal/androidtest: the AVD glutter-37 in .android-test, ANGLE over SwiftShader), and runs each scene of each APK in turn, once for each renderer of RENDERERS (vulkan,gles by default), and prints the RESULT line that the app logs after the app's name with the renderer and the scene, as ../run.sh does, so that ../summary.py takes its output.
The driver of the 2D comparison on the Android emulator (../android.sh builds the APKs and runs it): it starts the emulator of the device tests (internal/androidtest: the AVD glutter-37 in .android-test, ANGLE over SwiftShader), and runs each scene of each APK in turn, once for each renderer of RENDERERS (vulkan,gles by default), and prints the RESULT line that the app logs after the app's name with the renderer and the scene, as ../run.sh does, so that ../summary.py takes its output.
glutter command
The Glutter app of the 2D comparison of docs/BENCHMARKS.md: three scenes that the apps of Flutter, egui, iced, gpui and GTK beside it draw the same way.
The Glutter app of the 2D comparison of docs/BENCHMARKS.md: three scenes that the apps of Flutter, egui, iced, gpui and GTK beside it draw the same way.
web command
The driver of the 2D comparison on the web (../web.sh builds the sites and runs it): it loads the page of each site in headless Chromium, one at a time, each scene of each app in turn, and prints the RESULT line that the page reports after the app's name and the scene, as ../run.sh does, so that ../summary.py takes its output.
The driver of the 2D comparison on the web (../web.sh builds the sites and runs it): it loads the page of each site in headless Chromium, one at a time, each scene of each app in turn, and prints the RESULT line that the page reports after the app's name and the scene, as ../run.sh does, so that ../summary.py takes its output.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL