Skip to content

Commit 04f1e6f

Browse files
committed
Provide categories in summary
1 parent 7027c45 commit 04f1e6f

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

site/src/comparison.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,11 @@ impl ComparisonSummary<'_> {
151151
.map(|(i, _)| i);
152152
let hi = hi.map(|hi| benchmarks.remove(hi));
153153

154-
benchmarks.clear();
155-
156154
Some(ComparisonSummary { hi, lo })
157155
}
156+
158157
/// The direction of the changes
159-
fn direction(&self) -> Option<Direction> {
158+
pub fn direction(&self) -> Option<Direction> {
160159
let d = match (&self.hi, &self.lo) {
161160
(None, None) => return None,
162161
(Some(b), None) => b.direction(),
@@ -497,7 +496,7 @@ impl BenchmarkComparison<'_> {
497496

498497
// The direction of a performance change
499498
#[derive(PartialEq, Eq, Hash)]
500-
enum Direction {
499+
pub enum Direction {
501500
Improvement,
502501
Regression,
503502
Mixed,

site/src/github.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ pub async fn post_finished(data: &InputData) {
638638
format!(
639639
"Finished benchmarking try commit ({}): [comparison url]({}).
640640
641-
Summary: {}
641+
**Summary**: {}
642642
643643
Benchmarking this pull request likely means that it is \
644644
perf-sensitive, so we're automatically marking it as not fit \
@@ -672,12 +672,25 @@ async fn categorize_benchmark(commit: &database::QueuedCommit, data: &InputData)
672672
Ok(Some(c)) => c,
673673
_ => return String::from("ERROR categorizing benchmark run!"),
674674
};
675-
let summary = match crate::comparison::ComparisonSummary::summarize_comparison(&comparison) {
676-
Some(s) => s,
677-
None => return String::from("This benchmark run did not return any significant changes"),
675+
let (summary, direction) =
676+
match crate::comparison::ComparisonSummary::summarize_comparison(&comparison) {
677+
Some(s) if s.direction().is_some() => {
678+
let direction = s.direction().unwrap();
679+
(s, direction)
680+
}
681+
_ => return String::from("This benchmark run did not return any significant changes"),
682+
};
683+
684+
use crate::comparison::Direction;
685+
let category = match direction {
686+
Direction::Improvement => "improvements 🎉",
687+
Direction::Regression => "regressions 😿",
688+
Direction::Mixed => "mixed results 🤷",
678689
};
679-
680-
let mut result = format!("This change led to significant changes in compiler performance.\n");
690+
let mut result = format!(
691+
"This change led to significant {} in compiler performance.\n",
692+
category
693+
);
681694
for change in summary.ordered_changes() {
682695
use std::fmt::Write;
683696
write!(result, "- ").unwrap();

0 commit comments

Comments
 (0)