gpui: Improve path rendering and bounds performance#44655
Merged
cameron1024 merged 7 commits intozed-industries:mainfrom Dec 12, 2025
Merged
gpui: Improve path rendering and bounds performance#44655cameron1024 merged 7 commits intozed-industries:mainfrom
cameron1024 merged 7 commits intozed-industries:mainfrom
Conversation
Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
Contributor
Author
is this the right number? Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
marcocondrache
commented
Dec 12, 2025
Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
mikayla-maki
approved these changes
Dec 12, 2025
Member
mikayla-maki
left a comment
There was a problem hiding this comment.
Wow, this code is so clean! And thank you for the detailed explanation and data backing it up. Nothing looks amiss in Zed rendering + it passes the tests, so I think we're good to go :D
mikayla-maki
pushed a commit
that referenced
this pull request
Dec 14, 2025
nrbnlulu
pushed a commit
to nrbnlulu/zed
that referenced
this pull request
Dec 14, 2025
CherryWorm
pushed a commit
to CherryWorm/zed
that referenced
this pull request
Dec 16, 2025
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.

On my macOS machine, the paths_bench example currently runs at about 40 fps in release mode. Profiling shows that at a 24 ms frame interval, roughly 6–9 ms are spent on the GPU (fragment work, which still needs optimization), while the remainder is CPU time. After more accurate profiling, the frame graph revealed that most of the CPU cost came from bounds tree insertion
The issue is that the existing tree structure performs poorly when many bounds are identical, which is exactly what happens in paths_bench.
The new implementation is a variant of an R-tree. I may experiment with an R*-tree variant later, but the current approach already addresses three major problems:
Fast path for max leaf (now O(1) for overlapping bounds)
Before: Every insertion walked the entire tree to find the maximum intersecting ordering.
After: The tree maintains a pointer to the leaf with the global maximum ordering, letting us test it immediately.
Higher branching factor
The tree now uses four children per node instead of two, which reduces height and improves traversal efficiency.
Better overall balancing
Node selection and splitting strategies produce a more stable and evenly distributed tree structure.
These changes reduce insertion complexity:
And specific operations improve significantly:
In the paths_bench example, these changes produce a 100% performance improvement, increasing the frame rate from 40 fps to 80 fps. With a few more optimizations, I believe we can push the example to around 120 fps.
Before:
After:
Release Notes: