Skip to content

Commit c186ad4

Browse files
committed
Fix percentages
1 parent 960c67f commit c186ad4

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

site/src/comparison.rs

+11-17
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,8 @@ impl BenchmarkVariance {
545545
const SIGNFICANT_DELTA_THRESHOLD: f64 = 0.01;
546546
/// The percentage of significant changes that we consider too high
547547
const SIGNFICANT_CHANGE_THRESHOLD: f64 = 5.0;
548-
/// The percentage of change that constitutes noisy data
549-
const NOISE_THRESHOLD: f64 = 0.1;
548+
/// The ratio of change that constitutes noisy data
549+
const NOISE_THRESHOLD: f64 = 0.001;
550550

551551
fn push(&mut self, value: f64) {
552552
self.data.push(value);
@@ -580,26 +580,24 @@ impl BenchmarkVariance {
580580
);
581581

582582
if percent_significant_changes > Self::SIGNFICANT_CHANGE_THRESHOLD {
583-
self.description =
584-
BenchmarkVarianceDescription::HighlyVariable(percent_significant_changes);
583+
self.description = BenchmarkVarianceDescription::HighlyVariable;
585584
return;
586585
}
587586

588587
let delta_mean =
589588
non_significant.iter().map(|(&d, _)| d).sum::<f64>() / (non_significant.len() as f64);
590-
let percent_change = (delta_mean / results_mean) * 100.0;
591-
debug!("Percent change: {:.3}%", percent_change);
592-
if percent_change > Self::NOISE_THRESHOLD {
593-
self.description = BenchmarkVarianceDescription::Noisy(percent_change);
589+
let ratio_change = delta_mean / results_mean;
590+
debug!("Ratio change: {:.3}", ratio_change);
591+
if ratio_change > Self::NOISE_THRESHOLD {
592+
self.description = BenchmarkVarianceDescription::Noisy;
594593
}
595594
}
596595

597596
/// Whether we can trust this benchmark or not
598597
fn is_dodgy(&self) -> bool {
599598
matches!(
600599
self.description,
601-
BenchmarkVarianceDescription::Noisy(_)
602-
| BenchmarkVarianceDescription::HighlyVariable(_)
600+
BenchmarkVarianceDescription::Noisy | BenchmarkVarianceDescription::HighlyVariable
603601
)
604602
}
605603
}
@@ -610,14 +608,10 @@ pub enum BenchmarkVarianceDescription {
610608
Normal,
611609
/// A highly variable benchmark that produces many significant changes.
612610
/// This might indicate a benchmark which is very sensitive to compiler changes.
613-
///
614-
/// Cotains the percentage of significant changes.
615-
HighlyVariable(f64),
611+
HighlyVariable,
616612
/// A noisy benchmark which is likely to see changes in performance simply between
617613
/// compiler runs.
618-
///
619-
/// Contains the percent change that happens on average
620-
Noisy(f64),
614+
Noisy,
621615
}
622616

623617
impl Default for BenchmarkVarianceDescription {
@@ -668,7 +662,7 @@ impl TestResultComparison {
668662

669663
/// The amount of relative change considered significant when
670664
/// the test case is dodgy
671-
const SIGNIFICANT_RELATIVE_CHANGE_THRESHOLD_DODGY: f64 = 1.0;
665+
const SIGNIFICANT_RELATIVE_CHANGE_THRESHOLD_DODGY: f64 = 0.01;
672666

673667
fn log_change(&self) -> f64 {
674668
let (a, b) = self.results;

0 commit comments

Comments
 (0)