Use diff summary for action log stats instead of iterating hunks (#61272)

The diff already has a constant-time accessor to get the counts of
added/removed rows, use that instead of iterating hunks on the
foreground.

Release Notes:
- Improved performance in agent threads with many file changes.
This commit is contained in:
Cole Miller authored and GitHub committed 2026-07-20 16:17:02 +00:00
1 parent 8e1f9eabc0
commit 87a08f30eb
3 files changed
+14 -19

No files matched your search

+6
View File
@@ -2122,6 +2122,12 @@ impl BufferDiff {
.is_some_and(|diff_snapshot| diff_snapshot.base_text_exists)
}
pub fn changed_row_counts(&self) -> (u32, u32) {
self.diff_snapshot
.as_ref()
.map_or((0, 0), |diff_snapshot| diff_snapshot.changed_row_counts())
}
pub fn snapshot(&self, cx: &App) -> BufferDiffSnapshot {
let mut snapshot = self.diff_snapshot.clone().unwrap_or_else(|| {
let base_text = self.base_text_buffer.read(cx).snapshot();