Skip to content

Commit da65e82

Browse files
committed
Fix bug where we were calculating mean delta incorrectly
1 parent 42db59e commit da65e82

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

site/src/comparison.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,6 @@ impl BenchmarkVariance {
644644
self.data.push(value);
645645
}
646646

647-
fn mean(&self) -> f64 {
648-
self.data.iter().sum::<f64>() / self.data.len() as f64
649-
}
650-
651647
/// The percent change of the deltas sorted from smallest delta to largest
652648
fn percent_changes(&self) -> Vec<f64> {
653649
let mut deltas = self
@@ -686,7 +682,6 @@ impl BenchmarkVariance {
686682
fn calculate_description(&mut self) {
687683
self.description = BenchmarkVarianceDescription::Normal;
688684

689-
let results_mean = self.mean();
690685
let percent_changes = self.percent_changes();
691686
let non_significant = percent_changes
692687
.iter()
@@ -708,8 +703,8 @@ impl BenchmarkVariance {
708703

709704
let delta_mean =
710705
non_significant.iter().cloned().sum::<f64>() / (non_significant.len() as f64);
711-
let ratio_change = delta_mean / results_mean;
712-
if ratio_change > Self::NOISE_THRESHOLD {
706+
debug!("Ratio change: {:.4}", delta_mean);
707+
if delta_mean > Self::NOISE_THRESHOLD {
713708
self.description = BenchmarkVarianceDescription::Noisy;
714709
}
715710
}

0 commit comments

Comments
 (0)