Skip to content

Commit

Permalink
Merge pull request #1844 from erikdesjardins/combine
Browse files Browse the repository at this point in the history
When printing binary stats diff, combine all unchanged rows into one
  • Loading branch information
Kobzol committed Mar 10, 2024
2 parents 6f88fc5 + a86ca11 commit fcd48e1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions collector/src/bin/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,30 @@ fn print_binary_stats(
}
}
rows.sort_by_cached_key(|row| Reverse((row.diff.abs(), row.before, row.name.clone())));

// Combine all unchanged rows into one.
if use_diff {
let mut unchanged_count = 0;
let mut total_unchanged = 0;
rows.retain(|row| {
if row.diff == 0 {
unchanged_count += 1;
total_unchanged += row.before;
false
} else {
true
}
});
if total_unchanged > 0 {
rows.push(Row {
name: format!("<{unchanged_count} unchanged rows>"),
before: total_unchanged,
after: total_unchanged,
diff: 0,
});
}
}

rows.push(Row {
name: "Total".to_string(),
before: total_before,
Expand Down

0 comments on commit fcd48e1

Please sign in to comment.