Skip to content

Batch excerpt insertions per file when opening commit view#57330

Merged
cole-miller merged 1 commit into
mainfrom
batch-commit-view-excerpts
May 25, 2026
Merged

Batch excerpt insertions per file when opening commit view#57330
cole-miller merged 1 commit into
mainfrom
batch-commit-view-excerpts

Conversation

@cole-miller

@cole-miller cole-miller commented May 21, 2026

Copy link
Copy Markdown
Member

When viewing the diff for a commit where one of the files has a large number (hundreds or thousands) of diff hunks, we can get a hang on the main thread, since there's a large amount of work to recompute diff transforms for thousands of excerpts. This PR makes it so that we batch the addition of excerpts, with yield points in between batches so the UI remains responsive.

We should have something similar for the project diff, but that's a bit trickier; will address it in a separate PR.

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • Improved performance when opening the commit view with files that have many diff hunks.

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label May 21, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label May 21, 2026
@cole-miller cole-miller added this pull request to the merge queue May 25, 2026
Merged via the queue into main with commit a8cdf1d May 25, 2026
45 checks passed
@cole-miller cole-miller deleted the batch-commit-view-excerpts branch May 25, 2026 14:44
TomPlanche pushed a commit to TomPlanche/zed that referenced this pull request Jun 2, 2026
…tries#57330)

When viewing the diff for a commit where one of the files has a large
number (hundreds or thousands) of diff hunks, we can get a hang on the
main thread, since there's a large amount of work to recompute diff
transforms for thousands of excerpts. This PR makes it so that we batch
the addition of excerpts, with yield points in between batches so the UI
remains responsive.

We should have something similar for the project diff, but that's a bit
trickier; will address it in a separate PR.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Improved performance when opening the commit view with files that have
many diff hunks.
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.

2 participants