Skip to content

armgit / BUI

Public Imported from GitHub
0

Blender's GPU Accelerated UI, Decoupled from it's original codebase. Supports Rust, Python, JS, React, C & C++. Twice as good as GPUI

chore: add benches

Preetham Pemmasanieea4e9ee52d0
diff --git a/README.md b/README.md
index c4a392e..4ed12a9 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,19 @@ People spent decades building and optimizing Blender's GUI. It's battery and mem
![Platforms](https://img.shields.io/badge/platforms-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey)
[![Discord](https://img.shields.io/badge/chat-Discord-5865F2?logo=discord&logoColor=white)](https://discord.gg/MWXZfdyM3D)
-<a href="https://hackergit.org/r/ppmpreetham/BUI"><img src="https://hackergit.org/badge/ppmpreetham/BUI.svg?style=card" alt="Hacker News" width="250" height="55"></a>
+<table>
+ <tr>
+ <td>
+ <a href="https://hackergit.org/r/ppmpreetham/BUI"><img src="https://hackergit.org/badge/ppmpreetham/BUI.svg?style=rank&rank=day" alt="Hacker News" width="250" height="55"></a>
+ </td>
+ <td>
+ <a href="https://hackergit.org/r/ppmpreetham/BUI"><img src="https://hackergit.org/badge/ppmpreetham/BUI.svg?style=rank&rank=week" alt="Hacker News" width="250" height="55"></a>
+ </td>
+ <td>
+ <a href="https://hackergit.org/r/ppmpreetham/BUI"><img src="https://hackergit.org/badge/ppmpreetham/BUI.svg?style=rank" alt="Hacker News" width="250" height="55"></a>
+ </td>
+ </tr>
+</table>
**Website and full documentation: [bui.preetham.top](https://bui.preetham.top)** · **Chat: [Discord](https://discord.gg/MWXZfdyM3D)**
@@ -1894,17 +1906,17 @@ ship. The tables below have the details.
**Planned (coming soon)**
-| Target | Plan |
-| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| **WebAssembly** | The kit in the browser: the raster blits to `<canvas>`, DOM events feed the kit; `@blender-ui/react` and the DOM-like API on top, unchanged |
-| **egui** | BUI panels inside egui, plus a Blender-styled theme |
-| **More from Blender's source** | Per-glyph font fallback (BLF), IME, search-as-you-type popups, units in number fields, widget drag and drop |
-| **macOS GPU and JavaScript windows** | The GPU renderer on Metal (or the OpenGL backend), and Node windows on the main thread |
-| **More GPU backends** | Vulkan / WebGPU drawing the same instance stream as Direct3D 11 and OpenGL |
-| **Accessibility** | Screen-reader support through UI Automation (Windows), AT-SPI (Linux) and NSAccessibility (macOS) |
-| **Qt parity** | Measure against PySide6, run the same programs on Qt and BUI, fill in the missing classes, then `install()` so `import PySide6` programs run unchanged |
-| **More JavaScript frameworks** | Vue and Angular, as thin adapters over `@blender-ui/native` (the layer React and Svelte share) |
-| **More languages** | Lua (a community pull request is in review), Ruby, Go (through cgo), C#, Zig, Swift, Kotlin and MyGo over the same C header; Godot, Unity and Bevy; Flutter|
+| Target | Plan |
+| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| **WebAssembly** | The kit in the browser: the raster blits to `<canvas>`, DOM events feed the kit; `@blender-ui/react` and the DOM-like API on top, unchanged |
+| **egui** | BUI panels inside egui, plus a Blender-styled theme |
+| **More from Blender's source** | Per-glyph font fallback (BLF), IME, search-as-you-type popups, units in number fields, widget drag and drop |
+| **macOS GPU and JavaScript windows** | The GPU renderer on Metal (or the OpenGL backend), and Node windows on the main thread |
+| **More GPU backends** | Vulkan / WebGPU drawing the same instance stream as Direct3D 11 and OpenGL |
+| **Accessibility** | Screen-reader support through UI Automation (Windows), AT-SPI (Linux) and NSAccessibility (macOS) |
+| **Qt parity** | Measure against PySide6, run the same programs on Qt and BUI, fill in the missing classes, then `install()` so `import PySide6` programs run unchanged |
+| **More JavaScript frameworks** | Vue and Angular, as thin adapters over `@blender-ui/native` (the layer React and Svelte share) |
+| **More languages** | Lua (a community pull request is in review), Ruby, Go (through cgo), C#, Zig, Swift, Kotlin and MyGo over the same C header; Godot, Unity and Bevy; Flutter |
Our roadmap has no dates on it. Like a good render, it's done when the noise
goes away.
diff --git a/website/src/content/docs/performance/benchmarks.mdx b/website/src/content/docs/performance/benchmarks.mdx
index 0cbd97d..542043b 100644
--- a/website/src/content/docs/performance/benchmarks.mdx
+++ b/website/src/content/docs/performance/benchmarks.mdx
@@ -3,12 +3,15 @@ title: Benchmarks
description: "BUI's published numbers with their full context: start time and battery cost for every API, frame times, Rust against gpui, and JavaScript startup and animation."
section: Performance
order: 10
-badges: ["Ryzen 7 5800U", "Windows 11"]
+badges: ["Windows 11", "Linux"]
sources: ["README.md", "bindings/rust/bench/README.md", "docs/javascript.md", "bench/run.py", "bench/apps", "bindings/rust/bench/common/settings.rs", "bindings/node/bench/startup.js", "bindings/node/bench/cells.js"]
---
BUI is fast where it matters to people: it opens quickly, it sits at zero CPU while you're not touching it, and it stays smooth when thousands of things move. Here are the numbers, with everything you need to judge them.
+<Tabs sync="os" label="Operating system">
+<Tab label="Windows">
+
<Callout type="warning" title="Where these numbers come from">
Every number on this page was measured on **one laptop: a Ryzen 7 5800U** (8 cores, 16 threads, AMD Radeon integrated GPU, 60 Hz display), running **Windows 11 on AC power**, with release builds. They were measured **before the latest features landed**: Dear ImGui support, the Linux GPU renderer, and Blender's search and expression code. Your machine will give different numbers; the comparisons are what carry over. [Run the benchmarks yourself](../run-benchmarks/) to check.
</Callout>
@@ -116,6 +119,45 @@ More results, at 100 and 1,000 cells:
- **Memory:** Svelte keeps 10–17 MB more than React with signals at 3,000 cells. A heap snapshot puts it in Svelte's own effects, closures and each-block items (about 1.9 KB per cell); BUI's nodes are the same objects for both.
- **Startup:** with its runtime bundled, a Svelte app reaches its first frame within 10–15 ms of a React one on Node.js and Bun (it was 0.1–0.3 s later), and as fast as React's when built with `bui build`.
+</Tab>
+<Tab label="Linux">
+
+<Callout type="warning" title="Where the Linux numbers come from">
+Measured on **one laptop: an Intel Core i5-12500H** (16 threads, 15 GB, Intel Iris Xe, Mesa 25.3, a 1920×1080 display at 120 Hz), in **KDE Plasma on Wayland** (BUI windows run through Xwayland), on mains power, with release builds. They include the Linux GPU start-up work from [pull request #10](https://github.com/ppmpreetham/BUI/pull/10). CPU time is the run time of all threads and memory is resident memory; the Windows tab used CPU cycles and the working set, and the GPU renderer there is Direct3D 11 where here it is OpenGL 3.3. The two machines differ, so compare the shape of the results, not single numbers. The X11 loop sleeps 16.7 ms after each frame, so animation here stays below 60 FPS whatever the render time.
+</Callout>
+
+## Linux: start time and battery
+
+The same small settings window written each of the five ways (see [`bench/apps`](https://github.com/ppmpreetham/BUI/tree/main/bench/apps)), on the CPU renderer and the GPU renderer.
+
+<BenchTable id="linuxStart" />
+
+- On the GPU renderer the device starts on a worker thread, so the first frame no longer waits for the OpenGL driver: Rust opens in 61 ms, and the Python APIs in about 100 to 150 ms.
+- An idle window switches to the GPU as soon as it is ready and releases its CPU frame buffers, so idle CPU stays at about zero.
+
+## Linux: frame times
+
+<BenchTable id="linuxFrames" />
+
+## Linux: JavaScript
+
+<BenchTable id="linuxJsStartup" />
+
+<BenchTable id="linuxJsAnim" />
+
+<BenchTable id="linuxJsFrameworks" />
+
+## Linux: Rust compile times
+
+<BenchTable id="linuxBuildCommands" />
+
+<BenchTable id="linuxBuild" />
+
+A release build is 7.2 MB against 100 MB for a debug one, and an incremental rebuild takes under two seconds.
+
+</Tab>
+</Tabs>
+
<Callout type="joke">
Unlike a Cycles render, these numbers don't get any less noisy if you leave them running overnight. Run each benchmark a few times instead.
</Callout>
diff --git a/website/src/data/bench.ts b/website/src/data/bench.ts
index f8a60dc..2296315 100644
--- a/website/src/data/bench.ts
+++ b/website/src/data/bench.ts
@@ -417,6 +417,97 @@ const tablesBase = {
],
note: "Ryzen 7 5800U laptop, 16 GB, Windows 11, Direct3D 11. Frame time is the main thread from the start of the root view's render to the end of paint; GPU submission and the 60 Hz wait are not in it (all three show 60 FPS). Scrolling is 57 px per frame, driven the same way for all three; the empty window with the same harness takes 0.13 ms and 102 allocations per frame. RAM is the working set after the scroll minus the same window with 100 items (about 29 MB) and minus the data. Nobody hit the 4 GB or 150 s limits, so there are no failures to report: gpui's list held ten million items in 910 MB and virtual_list took 7.3 s to build its size table. virtual_list's sizes come from a cheap synthetic text width, which favours it. Our first frame at 100 and 10,000 items is window creation. Not measured: GPU time, other machines, selection and keyboard latency, streaming updates on the competitors. The machine was in normal use during the runs.",
},
+ linuxStart: {
+ caption: "Linux: start time and battery, the same settings window written each way (bench/apps), median of 10 launches, idle figures over 20 seconds",
+ columns: ["", "Renderer", "Start time", "CPU used to start", "Memory (idle)", "Idle CPU per minute"],
+ numeric: [2, 3, 4, 5],
+ rows: [
+ ["<strong>Rust</strong> (HTML + CSS)", "CPU", "32 ms", "13 ms", "17 MB", "0.2 ms"],
+ ["", "GPU", "61 ms", "60 ms", "59 MB", "0 ms"],
+ ["<strong>JavaScript</strong> (React, Node.js)", "CPU", "112 ms", "119 ms", "64 MB", "0.5 ms"],
+ ["", "GPU", "101 ms", "120 ms", "106 MB", "1.1 ms"],
+ ["<strong>Blender components</strong> (Python)", "CPU", "90 ms", "87 ms", "27 MB", "0.3 ms"],
+ ["", "GPU", "96 ms", "97 ms", "68 MB", "0 ms"],
+ ["<strong>tkinter syntax</strong> (Python)", "CPU", "145 ms", "141 ms", "36 MB", "0 ms"],
+ ["", "GPU", "147 ms", "144 ms", "71 MB", "0 ms"],
+ ["<strong>Qt syntax</strong> (Python)", "CPU", "133 ms", "129 ms", "30 MB", "0 ms"],
+ ["", "GPU", "137 ms", "139 ms", "72 MB", "0 ms"],
+ ["<strong>Same gpui code</strong>: blenderui", "CPU", "10 ms", "9 ms", "17 MB", "0 ms"],
+ ["", "GPU", "23 ms", "23 ms", "59 MB", "0 ms"],
+ ],
+ note: "Includes the Linux GPU start-up work from pull request #10 (the OpenGL device is created on a worker thread, so the first frame no longer waits for the driver, and an idle window switches to the GPU when it is ready). Gpui itself was not run on Linux. CPU time is all threads (/proc schedstat), memory is resident memory (VmRSS) and does not count GPU memory.",
+ },
+ linuxFrames: {
+ caption: "Linux: frame times. Python is headless; Rust is bui-bench with 3,000 cells changing every frame, median of 3 runs",
+ columns: ["", "Time / value"],
+ numeric: [1],
+ rows: [
+ ["Python, full components demo (520×900): complete frame", "1.38 ms"],
+ ["Python: hover frame (damage only)", "0.059 ms"],
+ ["Rust 3,000 cells, GPU: FPS / CPU per frame / RAM", "25.6 / 21.7 ms / 78 MB"],
+ ["Rust 3,000 cells, GPU: first frame / idle CPU", "~5 ms / 0.1 %"],
+ ["Rust 3,000 cells, CPU: FPS / CPU per frame / RAM", "20.1 / 30.9 ms / 35 MB"],
+ ["Rust 3,000 cells, CPU: first frame / idle CPU", "~6 ms / 0.1 %"],
+ ],
+ note: "The X11 loop sleeps 16.7 ms after each frame, so each frame takes its render time plus 16.7 ms and the animation stays below 60 FPS; the frame rate is set by that sleep, not by rendering.",
+ },
+ linuxJsStartup: {
+ caption: "Linux: JavaScript startup, a small React app that quits after its first frame (GPU renderer), median of 12 launches after a warm-up",
+ columns: ["", "First frame", "Launch to exit", "RAM at first frame"],
+ numeric: [1, 2, 3],
+ rows: [
+ ["Node.js (React)", "111 ms", "204 ms", "56.5 MB"],
+ ["Node.js (Svelte)", "256 ms", "-", "80.0 MB"],
+ ["Rust, for reference (CPU)", "~4 ms", "32 ms to ready", "-"],
+ ],
+ note: "Bun is not installed on this machine, so the Bun and QuickJS executables were not measured. The Svelte row is the median of 8 launches.",
+ },
+ linuxJsAnim: {
+ caption: "Linux: JavaScript animation, one cell changes per frame, GPU renderer, median of 3 runs",
+ columns: ["", "FPS", "CPU per frame", "RAM"],
+ numeric: [1, 2, 3],
+ rows: [
+ ["3,000 cells, Rust", "26.7", "<strong>20.1 ms</strong>", "<strong>78 MB</strong>"],
+ ["3,000 cells, Node 24: plain JS / React with signals / React with state", "24.4 / 25.6 / 25.4", "23.9 / 22.1 / 27.6 ms", "140 / 149 / 278 MB"],
+ ["1,000 cells, Rust", "40.1", "<strong>7.8 ms</strong>", "<strong>68 MB</strong>"],
+ ["1,000 cells, Node 24: plain JS / React with signals / React with state", "40.0 / 39.6 / 39.6", "8.2 / 8.5 / 10.4 ms", "116 / 122 / 192 MB"],
+ ],
+ note: "JavaScript adds 0.4 to 0.7 ms per frame at 1,000 cells. With signals, React costs the same as plain JS; React with state renders the grid again every frame and uses about twice the memory.",
+ },
+ linuxJsFrameworks: {
+ caption: "Linux: React and Svelte side by side, 3,000 cells, CPU renderer, Node 24, median of 6 runs (every variant runs at 21 FPS)",
+ columns: ["", "CPU per frame", "RAM", "JavaScript per update"],
+ numeric: [1, 2, 3],
+ rows: [
+ ["Plain JS", "29.8 ms", "95 MB", "17 µs"],
+ ["React with signals", "30.2 ms", "105 MB", "31 µs"],
+ ["Svelte with signals (as values)", "29.9 ms", "133 MB", "22 µs"],
+ ["Svelte with runes", "30.5 ms", "133 MB", "121 µs"],
+ ["React with state", "36.1 ms", "234 MB", "2.4 ms"],
+ ],
+ note: "The JavaScript column is 500 updates run back to back, each applied and sent to the UI thread. Standard deviation of CPU per frame is 0.3 to 0.9 ms.",
+ },
+ linuxBuildCommands: {
+ caption: "Linux: Rust compile times, clean builds",
+ columns: ["Command", "Wall time", "Memory"],
+ numeric: [1, 2],
+ rows: [
+ ["<code>cargo build --release -p blenderui</code>", "40.9 s", "752 MB"],
+ ["<code>cargo build --release</code> (workspace, with Node and QuickJS)", "53.1 s", "744 MB"],
+ ["<code>cargo build</code> (workspace, debug)", "46.3 s", "723 MB"],
+ ],
+ },
+ linuxBuild: {
+ caption: "Linux: Rust compile times and binary size, a clean build and an incremental one",
+ columns: ["Build", "Wall time", "CPU time (user + sys)", "Binary size"],
+ numeric: [1, 2, 3],
+ rows: [
+ ["Debug, clean", "33.1 s", "142.5 s", "100 MB"],
+ ["Debug, incremental", "0.6 s", "1.4 s", "100 MB"],
+ ["Release, clean", "37.6 s", "221.0 s", "7.2 MB"],
+ ["Release, incremental", "1.6 s", "3.2 s", "7.2 MB"],
+ ],
+ },
imageDecode: {
caption: "Image decoding: milliseconds per image (median), the decoder BUI uses in bold",
columns: ["Format", "Image", "BUI (its decoder)", "Wuffs", "stb_image", "libspng", "libjpeg-turbo", "libwebp"],