# Batch excerpt insertions per file when opening commit view \(\#57330\) · gitcafe/zed

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

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

Visibility: public

Requested revision: a8cdf1d8692b74faba928f8948960277460eade9

Requested commit: a8cdf1d8692b74faba928f8948960277460eade9

Commit: a8cdf1d8692b74faba928f8948960277460eade9

Tree: 8bf794ef1fb4449fac14ba0f48dcaaa98477e8d0

Author: Cole Miller

Committer: GitHub

## Message

```
Batch excerpt insertions per file when opening commit view (#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.
```

## Parents

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

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