--- 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.