Skip to content

Commit dafc454

Browse files
committed
Filter our very small changes
1 parent ae39a5d commit dafc454

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

site/src/comparison.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ async fn populate_report(
150150
}
151151

152152
pub struct ComparisonSummary {
153-
/// Significant comparisons ordered by magnitude from largest to smallest
153+
/// Significant comparisons of magnitude small and above
154+
/// and ordered by magnitude from largest to smallest
154155
comparisons: Vec<TestResultComparison>,
155156
}
156157

@@ -160,6 +161,7 @@ impl ComparisonSummary {
160161
.statistics
161162
.iter()
162163
.filter(|c| c.is_significant())
164+
.filter(|c| c.magnitude().is_small_or_above())
163165
.cloned()
164166
.collect::<Vec<_>>();
165167
// Skip empty commits, sometimes happens if there's a compiler bug or so.
@@ -270,27 +272,22 @@ impl ComparisonSummary {
270272
}
271273

272274
pub fn confidence(&self) -> ComparisonConfidence {
273-
let mut num_very_small_changes = 0;
274275
let mut num_small_changes = 0;
275276
let mut num_medium_changes = 0;
276277
for c in self.comparisons.iter() {
277278
match c.magnitude() {
278-
Magnitude::VerySmall => num_very_small_changes += 1,
279279
Magnitude::Small => num_small_changes += 1,
280280
Magnitude::Medium => num_medium_changes += 1,
281281
Magnitude::Large => return ComparisonConfidence::DefinitelyRelevant,
282282
Magnitude::VeryLarge => return ComparisonConfidence::DefinitelyRelevant,
283+
Magnitude::VerySmall => unreachable!(),
283284
}
284285
}
285286

286-
match (
287-
num_very_small_changes,
288-
num_small_changes,
289-
num_medium_changes,
290-
) {
291-
(_, _, m) if m > 1 => ComparisonConfidence::DefinitelyRelevant,
292-
(_, _, m) if m > 0 => ComparisonConfidence::ProbablyRelevant,
293-
(vs, s, _) if (s * 2) + vs > 10 => ComparisonConfidence::ProbablyRelevant,
287+
match (num_small_changes, num_medium_changes) {
288+
(_, m) if m > 1 => ComparisonConfidence::DefinitelyRelevant,
289+
(_, 1) => ComparisonConfidence::ProbablyRelevant,
290+
(s, 0) if s > 10 => ComparisonConfidence::ProbablyRelevant,
294291
_ => ComparisonConfidence::MaybeRelevant,
295292
}
296293
}
@@ -867,9 +864,9 @@ impl TestResultComparison {
867864
Magnitude::VerySmall
868865
} else if change < threshold * 3.0 {
869866
Magnitude::Small
870-
} else if change < threshold * 10.0 {
867+
} else if change < threshold * 6.0 {
871868
Magnitude::Medium
872-
} else if change < threshold * 25.0 {
869+
} else if change < threshold * 18.0 {
873870
Magnitude::Large
874871
} else {
875872
Magnitude::VeryLarge
@@ -1003,6 +1000,10 @@ pub enum Magnitude {
10031000
}
10041001

10051002
impl Magnitude {
1003+
fn is_small_or_above(&self) -> bool {
1004+
*self >= Self::Small
1005+
}
1006+
10061007
fn is_medium_or_above(&self) -> bool {
10071008
*self >= Self::Medium
10081009
}

0 commit comments

Comments
 (0)