Skip to content

Commit ae89411

Browse files
committed
Small adjustments
1 parent c186ad4 commit ae89411

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

site/src/comparison.rs

+10-13
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,10 @@ impl ComparisonSummary {
161161

162162
/// The direction of the changes
163163
pub fn direction(&self) -> Option<Direction> {
164-
let d = match (
165-
self.largest_positive_change(),
166-
&self.largest_negative_change(),
167-
) {
164+
let d = match (self.largest_improvement(), self.largest_regression()) {
168165
(None, None) => return None,
169-
(Some(b), None) => b.direction(),
170-
(None, Some(b)) => b.direction(),
166+
(Some(c), None) => c.direction(),
167+
(None, Some(c)) => c.direction(),
171168
(Some(a), Some(b)) if a.is_increase() == b.is_increase() => a.direction(),
172169
_ => Direction::Mixed,
173170
};
@@ -186,12 +183,12 @@ impl ComparisonSummary {
186183
changes
187184
}
188185

189-
pub fn largest_positive_change(&self) -> Option<&TestResultComparison> {
190-
self.comparisons.first().filter(|s| s.is_increase())
186+
pub fn largest_improvement(&self) -> Option<&TestResultComparison> {
187+
self.comparisons.iter().filter(|s| !s.is_increase()).next()
191188
}
192189

193-
pub fn largest_negative_change(&self) -> Option<&TestResultComparison> {
194-
self.comparisons.last().filter(|s| !s.is_increase())
190+
pub fn largest_regression(&self) -> Option<&TestResultComparison> {
191+
self.comparisons.iter().filter(|s| s.is_increase()).next()
195192
}
196193

197194
pub fn confidence(&self) -> ComparisonConfidence {
@@ -228,7 +225,7 @@ impl ComparisonSummary {
228225

229226
/// The amount of confidence we have that a comparison actually represents a real
230227
/// change in the performance characteristics.
231-
#[derive(Clone, Copy)]
228+
#[derive(Clone, Copy, Debug)]
232229
pub enum ComparisonConfidence {
233230
MaybeRelevant,
234231
ProbablyRelevant,
@@ -658,7 +655,7 @@ pub struct TestResultComparison {
658655
impl TestResultComparison {
659656
/// The amount of relative change considered significant when
660657
/// the test case is not dodgy
661-
const SIGNIFICANT_RELATIVE_CHANGE_THRESHOLD: f64 = 0.001;
658+
const SIGNIFICANT_RELATIVE_CHANGE_THRESHOLD: f64 = 0.002;
662659

663660
/// The amount of relative change considered significant when
664661
/// the test case is dodgy
@@ -757,7 +754,7 @@ impl std::hash::Hash for TestResultComparison {
757754
}
758755

759756
// The direction of a performance change
760-
#[derive(PartialEq, Eq, Hash)]
757+
#[derive(PartialEq, Eq, Hash, Debug)]
761758
pub enum Direction {
762759
Improvement,
763760
Regression,

0 commit comments

Comments
 (0)