Repository navigation
GPUI: faster frames (balanced BoundsTree, cheaper text painting and scene finish) - #3887
Merged
Merged
Conversation
|
Sandchest reviewed Sandchest reviews every change for vulnerabilities an attacker could use · 2 credits · Review details |
richiemcilroy
force-pushed
the
gpui-perf/frame-pipeline
branch
from
November 6, 2026 13:57
75eaecd to
d011b6f
Compare
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
… caches Adds zed-perf.patch to the GPUI patch stack: - shape_line/layout_line no longer copy the text on every call - paint_line_background skips its per-glyph walk when no run has a background - paint_line resolves subpixel rendering and dilation once per run/color - text measurement only checks out a LineWrapper when truncating - FontFeatures::default shares one empty list instead of allocating - Frame::finish only scans element-state keys copied by view reuse - taffy keeps one per-node absolute layout map instead of two Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lean decoration runs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
richiemcilroy
force-pushed
the
gpui-perf/frame-pipeline
branch
from
November 6, 2026 14:06
d011b6f to
f64b15b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds
zed-perf.patchto the GPUI patch stack: CPU-side frame work gets cheaper on every platform, and every frame draws exactly the same scene as before.What changes
BoundsTreeis a balanced R-tree (crates/gpui/src/bounds_tree.rs).1 + max(order of earlier bounds that intersect). It is unchanged, and new tests check it against a brute-force scan on UI-shaped and random frames of up to 6 000 bounds.Scene::finishsorts(key, index)pairs, then permutes in place (scene.rs). Primitives are ~100 bytes and a stable sort moves each several times. Since every index is unique, an unstable sort of the pairs gives exactly the stable order. It skips work when the list is already sorted, and its scratch buffer is reused.text_system/line.rs,window.rs):paint_lineresolves subpixel rendering once per run and glyph dilation once per color instead of per glyph. On macOS the former takes the native window's lock.paint_line_backgroundreturns early when no run has a background. The layer is still pushed, so draw orders don't move.text_system.rs,elements/text.rs,font_features.rs):shape_lineandlayout_linekey the line cache without copying the text first.LineWrapperout of the pool when it truncates.FontFeatures::default()shares one empty list instead of allocating one inside everyWindow::text_style().shape_textno longer reserves 32 decoration runs (~3 KB) per line.window.rs).Frame::finishonly scans the keys thatreuse_prepaint/reuse_paintcopied from the previous frame.with_element_statealready moves every other key's state on first access, so the old scan over all keys could never find them.{ bounds, outer_origin }map instead of two maps that were always written, read and evicted together (taffy.rs).Results
Window::drawCPU time per frame, from the frame benchmarks in #3886: base is this branch's parent stack, head is this PR. The M4 is a dedicated Mac mini, 5 interleaved rounds. Windows and Linux are Blacksmith CI VMs, also 5 rounds; VM noise is ±10–30% per round, so mixed rounds on those columns are inconclusive.cached_panelsprimitives_8192primitives_1024paragraphs_12paragraphs_48text_rows_static_50text_rows_static_200text_rows_changing_50text_rows_changing_200recordings_scrollhover_cardscards_64cards_256cards_1024Bold: every round agreed.
The real Cap editor (
CAP_GPUI_AUTO_TIMELINE_BENCH, reference recording, release build, M4, 10 interleaved rounds, medianWindow::draw):cleantick-zoomed-outticktick-fieldsfollowhovercaption-downloadSame pixels
paint_tests.rspaints multi-color text through a rasterizing test text system and checks that every glyph sprite carries its own color's dilation, and that background runs still paint (and nothing else does).reused_element_state_testschecks that a cached view's element state survives frames where the view is reused.🤖 Generated with Claude Code