Skip to content

editor: Only compute word-diff highlights for visible rows - #58639

Merged
Veykril merged 1 commit into
mainfrom
push-zuuymuwuowko
Jun 5, 2026
Merged

editor: Only compute word-diff highlights for visible rows#58639
Veykril merged 1 commit into
mainfrom
push-zuuymuwuowko

Conversation

@Veykril

@Veykril Veykril commented Jun 5, 2026

Copy link
Copy Markdown
Member

Word diffs are stored per-hunk for the entire hunk range, but layout_word_diff_highlights converted every word diff of every hunk touching the viewport to display points each frame, even for the off-screen portion of a large, partially-visible hunk. Each conversion walks the inlay/fold/tab/wrap/block trees, so scrolling through a large modified hunk (especially in split diff mode, where both editors lay out every frame) caused frame drops proportional to the hunk's total size rather than its visible portion.

Filter word diffs by the visible buffer-offset window before converting. Buffer offset to display point is order-preserving, so this is equivalent to the existing per-row filtering applied to the converted ranges.

Release Notes:

  • Improved scrolling performance in diff views containing large hunks with many computed word diffs

Word diffs are stored per-hunk for the entire hunk range, but
layout_word_diff_highlights converted every word diff of every hunk
touching the viewport to display points each frame, even for the
off-screen portion of a large, partially-visible hunk. Each conversion
walks the inlay/fold/tab/wrap/block trees, so scrolling through a large
modified hunk (especially in split diff mode, where both editors lay
out every frame) caused frame drops proportional to the hunk's total
size rather than its visible portion.

Filter word diffs by the visible buffer-offset window before converting.
Buffer offset to display point is order-preserving, so this is
equivalent to the existing per-row filtering applied to the converted
ranges.

Release Notes:

- Improved scrolling performance in diff views containing large hunks
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 5, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Jun 5, 2026
@Veykril
Veykril added this pull request to the merge queue Jun 5, 2026
Merged via the queue into main with commit 86effff Jun 5, 2026
43 checks passed
@Veykril
Veykril deleted the push-zuuymuwuowko branch June 5, 2026 12:53
TomPlanche pushed a commit to TomPlanche/zed that referenced this pull request Jun 8, 2026
…tries#58639)

Word diffs are stored per-hunk for the entire hunk range, but
layout_word_diff_highlights converted every word diff of every hunk
touching the viewport to display points each frame, even for the
off-screen portion of a large, partially-visible hunk. Each conversion
walks the inlay/fold/tab/wrap/block trees, so scrolling through a large
modified hunk (especially in split diff mode, where both editors lay out
every frame) caused frame drops proportional to the hunk's total size
rather than its visible portion.

Filter word diffs by the visible buffer-offset window before converting.
Buffer offset to display point is order-preserving, so this is
equivalent to the existing per-row filtering applied to the converted
ranges.

Release Notes:

- Improved scrolling performance in diff views containing large hunks
with many computed word diffs
This was referenced Jun 18, 2026
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
…tries#58639)

Word diffs are stored per-hunk for the entire hunk range, but
layout_word_diff_highlights converted every word diff of every hunk
touching the viewport to display points each frame, even for the
off-screen portion of a large, partially-visible hunk. Each conversion
walks the inlay/fold/tab/wrap/block trees, so scrolling through a large
modified hunk (especially in split diff mode, where both editors lay out
every frame) caused frame drops proportional to the hunk's total size
rather than its visible portion.

Filter word diffs by the visible buffer-offset window before converting.
Buffer offset to display point is order-preserving, so this is
equivalent to the existing per-row filtering applied to the converted
ranges.

Release Notes:

- Improved scrolling performance in diff views containing large hunks
with many computed word diffs
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…tries#58639)

Word diffs are stored per-hunk for the entire hunk range, but
layout_word_diff_highlights converted every word diff of every hunk
touching the viewport to display points each frame, even for the
off-screen portion of a large, partially-visible hunk. Each conversion
walks the inlay/fold/tab/wrap/block trees, so scrolling through a large
modified hunk (especially in split diff mode, where both editors lay out
every frame) caused frame drops proportional to the hunk's total size
rather than its visible portion.

Filter word diffs by the visible buffer-offset window before converting.
Buffer offset to display point is order-preserving, so this is
equivalent to the existing per-row filtering applied to the converted
ranges.

Release Notes:

- Improved scrolling performance in diff views containing large hunks
with many computed word diffs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants