# git: Implement branch diff line counts efficiently \(\#52582\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 564d1fe938e9cd7d27ac024caeecc25051830346

Requested commit: 564d1fe938e9cd7d27ac024caeecc25051830346

Commit: 564d1fe938e9cd7d27ac024caeecc25051830346

Tree: a9af1f9722f031e179ecb93f75491602bf05b81f

Author: Cole Miller

Committer: GitHub

## Message

```
git: Implement branch diff line counts efficiently (#52582)

Previously we were iterating over all hunks across all diffs on every
frame. Now we can read off the required information as a `SumTree`
summary in constant time.

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:

- git: Fixed bad performance in large branch diffs.
```

## Parents

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

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