A Critique of GPUI's State Model
An analysis of GPUI and egui state models argues that precise change tracking is necessary for complex desktop apps, and components that run once with signals offer the simplest API.
The Cost of Coarse Notifications
GPUI calls itself a hybrid immediate and retained mode framework. Entities hold state, render functions define the UI, and changes require an explicit notify. Rust has no write barrier, so GPUI cannot tell which field changed; notify carries an entity ID but offers no finer detail. The Angular team wrote that zone.js can only notify when something “might have happened,” and that approach has not scaled well. GPUI re-renders every view not behind a valid .cached() boundary. In benchmarks, changing one label among 3,000 cached rows took 8.4 ms, with hover, keystroke, and equal-value writes costing about the same. Plain-element rows took 92 ms. A handwritten equality guard reduced the equal write from 7.9 ms to 0.9 µs. Zed feels fast, but its UI is relatively simple; the text editor bypasses GPUI’s layout and view semantics.
Precision Undermines the API
To avoid re-rendering everything, the framework could retain more. gpui-fast preserves view subtrees, but the smallest reusable unit is a view. Updating a single label then requires an entity, a Render impl, a subscription, a stored copy, a guard, and an owner. A signal framework expresses the same dependency with a Memo and a Label derived. gpui-fast cuts the 3,000-row label from 8.4 ms to 3.4 ms, but the frame still walks the whole tree. In a 60-panel benchmark, panel-owned state saved 83% on a single change, while a shared model made the frame 11% slower with retention. The Zed team measured retention at 1–3% slower on ordinary workloads; microbenchmark wins did not predict real-Zed results. The author argues that keeping a plain render API gives view-sized updates, while taking precision loses the API’s simplicity. Missing notifications become application bugs.
Elm and Immediate Mode Share the Pattern
The Elm architecture looks simple at small scale, but in complex apps signals and stores are easier to reason about. An unread count must be updated in every message handler that touches threads; the compiler checks exhaustiveness but not arithmetic. cosmic-files has 136 top-level message variants and 73 more for a tab. Iced rebuilds the entire view after every batch of messages; 3,000 rows build 39,023 widgets and take 7.3 ms, with lazy rows only reducing that to 5.7 ms. egui avoids state synchronization, but frame cost scales with UI size. Small edits at 3,000 rows take about 32 ms, and long lists require fixed row heights. Rerun clamps queries using egui state from the previous frame, moving the synchronization problem into application code.
Run-Once Components
The author proposes that the simplest API is a component that runs once, with the framework tracking reads and re-running closures when dependencies change. An example sidebar creates a Memo for unread count, a Label derived from it, and a dyn_stack that preserves row identity. There are no hook rules, dependency arrays, stale closures, or PartialEq on props. Benchmarks show fine-grained reactivity wins, but signals do not rescue coarse state. Floem’s global revision signal is notify in signal clothing and was the slowest result. React engineers found similar limits with a giant input; Joe Savona concluded the data model is as important as the algorithm. State must be shaped like the reads.