Skip to content

enhance: only visit visible links and dots when rendering the commit graph - #2866

Open
bertyhell wants to merge 1 commit into
sourcegit-scm:developfrom
bertyhell:perf/graph-render-visible-range
Open

bertyhell wants to merge 1 commit into
sourcegit-scm:developfrom
bertyhell:perf/graph-render-visible-range

Conversation

@bertyhell

Copy link
Copy Markdown

Views.CommitGraph.Render iterated Links and Dots from the first item on every frame, skipping everything above
the viewport, which is O(commits) per frame when scrolled to the bottom of a long history. Both lists are ordered by Y
(one dot per commit row, each link ends half a row below its commit), so binary search the first visible item instead.
Paths keep the linear scan since a path that starts far above the viewport can still cross it.

The grayed pens are now created once in Models.CommitGraph.SetPens (and the dot fill pen is cached until DotBrush
changes) instead of being allocated on every frame.

🤖 Generated with Claude Code

…graph

`Views.CommitGraph.Render` iterated `Links` and `Dots` from the first item on every frame, skipping everything above
the viewport, which is O(commits) per frame when scrolled to the bottom of a long history. Both lists are ordered by Y
(one dot per commit row, each link ends half a row below its commit), so binary search the first visible item instead.
`Paths` keep the linear scan since a path that starts far above the viewport can still cross it.

The grayed pens are now created once in `Models.CommitGraph.SetPens` (and the dot fill pen is cached until `DotBrush`
changes) instead of being allocated on every frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KCxH1zwDXLd9kfAAkcf6PZ

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants