# editor: Only compute word-diff highlights for visible rows \(\#58639\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/86effffd34634945a4971e1c6c65cd45b21ce6a9)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 86effffd34634945a4971e1c6c65cd45b21ce6a9

Requested commit: 86effffd34634945a4971e1c6c65cd45b21ce6a9

Commit: 86effffd34634945a4971e1c6c65cd45b21ce6a9

Tree: 99d683711be04622c095074ec7e9986cf8dd27a8

Author: Lukas Wirth

Committer: GitHub

## Message

```
editor: Only compute word-diff highlights for visible rows (#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
```

## Parents

- [d11d7c837dfbe39e696cc864d9d56370b599a49e](https://git.cafe/gitcafe/zed/commit/d11d7c837dfbe39e696cc864d9d56370b599a49e?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/86effffd34634945a4971e1c6c65cd45b21ce6a9?format=markdown)
