Files
arena-tracker/docs/adr/0004-reduce-rendering-cost-instead-of-patching-gpui.md
T
nessarandClaude Opus 5.5 e13db17bcb
CI / core (pull_request) Successful in 1m7s
CI / core (push) Successful in 45s
Make fluid and light the app's rule #1, with measurable budgets
docs/performance.md sets five budgets measured on the reference laptop
on release builds (frame cost, idle CPU, hidden window, memory,
background work), a ratchet that only lowers them, and how to measure.
CLAUDE.md and the README point to it.

ADR-0004 records that GPUI is not patched to fix the stutter of #17:
upstream refused the same change (zed#66745), so the page's own
rendering cost has to come down instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 01:27:27 +01:00

2.3 KiB
Raw Blame History

status
status
accepted

Reduce rendering cost instead of patching GPUI

GPUI redraws the whole window on every move: its move callback calls refresh(), which also bypasses cached views, so dragging the window rebuilds a full frame of the statistics page for every WM_MOVE (issue #17). Measured on the reference machine (docs/performance.md), such a frame costs 5–7 ms in a release build, more than a 240 Hz frame. A 20-line patch on a vendored copy of gpui-pre removed that refresh for moves that keep the window's size and made dragging as smooth as File Explorer. We do not keep it: GPUI and gpui-component stay unmodified, and we make a full frame of the page cheap enough (rule #1, at most 2 ms) that redrawing it on every move or hover no longer shows.

Upstream refused the same change on 2026-11-11 (zed-industries/zed#66745): any view may read the window's bounds during render, and the refresh keeps such views correct, so skipping it is unsound in general; the maintainer's answer to stuttering is to fix excessive render times. A vendored patch would therefore never go away, and every gpui-kit upgrade would have to re-vendor GPUI, re-apply the patch and re-check that nothing reads the window's position during render.

Considered Options

  • Keep the vendored patch indefinitely: smooth dragging at once, but permanent maintenance on a 100,000-line copy of a pre-1.0 framework that releases weekly.
  • Keep the patch until a full frame is cheap enough: smooth meanwhile, but the patch and its maintenance would stay for as long as that work takes, with no guarantee of an end.
  • Reduce the page's rendering cost (chosen): no fork, and it also fixes hover and every other redraw, not only moves.

Consequences

  • Until a full frame of the statistics page costs at most 2 ms, dragging the window still stutters on high refresh rate displays (issue #17 stays open, blocked by that work).
  • GPUI and gpui-component are never patched to meet a performance budget; if a budget cannot be met within the app, its floor is measured, explained and becomes the budget (ratchet, docs/performance.md).
  • If GPUI later tracks which views read the window's bounds, as its maintainer suggested, moves may stop redrawing upstream; nothing here prevents taking that upgrade.