Skip to content

Commit 1400822

Browse files
committed
refactor(bench): remove max value and outliers analysis from latency stats
Removed the max value from latency statistics as it's unreliable in microbenchmarks due to OS scheduler, context switches, cache misses, and CPU frequency scaling. A single outlier provides no meaningful information for performance analysis. Changes: - Removed 'Max' from statistics display - Removed 'Outliers (max/p99 ratio)' analysis - Fixed stddev formatting to use same format as other durations (ns/μs/ms) - Kept only meaningful metrics: Min, p50, p95, p99, Stddev Now shows: Min: 285ns p50: 560ns p95: 820ns p99: 902ns Stddev: 283ns Analysis: - Consistency: 1.61x (excellent - very predictable) - Variance: 50.7% (high - jittery) p99 already tells you what 99% of operations are like, which is more actionable than a single worst-case outlier.
1 parent e6e64f3 commit 1400822

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/bin/bench_throughput.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -586,24 +586,21 @@ fn print_template_results(template_name: &str, results: &[BenchmarkResult]) {
586586
format_size(largest_result.input_size)
587587
);
588588
println!(
589-
" Min: {} p50: {} p95: {} p99: {} Max: {} Stddev: {:.2}ns",
589+
" Min: {} p50: {} p95: {} p99: {} Stddev: {}",
590590
format_duration(stats.min),
591591
format_duration(stats.p50),
592592
format_duration(stats.p95),
593593
format_duration(stats.p99),
594-
format_duration(stats.max),
595-
stats.stddev
594+
format_duration(Duration::from_nanos(stats.stddev as u64))
596595
);
597596

598597
// Performance consistency analysis
599598
let p50_ns = stats.p50.as_nanos() as f64;
600599
let p99_ns = stats.p99.as_nanos() as f64;
601-
let max_ns = stats.max.as_nanos() as f64;
602600

603601
if p50_ns > 0.0 {
604602
let p99_p50_ratio = p99_ns / p50_ns;
605603
let stddev_percent = (stats.stddev / p50_ns) * 100.0;
606-
let max_p99_ratio = max_ns / p99_ns;
607604

608605
println!(" Analysis:");
609606

@@ -628,16 +625,6 @@ fn print_template_results(template_name: &str, results: &[BenchmarkResult]) {
628625
} else {
629626
println!(" (high - jittery)");
630627
}
631-
632-
// Outliers (max/p99 ratio)
633-
print!(" - Outliers: {:.2}x", max_p99_ratio);
634-
if max_p99_ratio < 2.0 {
635-
println!(" (few outliers)");
636-
} else if max_p99_ratio < 5.0 {
637-
println!(" (some outliers)");
638-
} else {
639-
println!(" (many outliers)");
640-
}
641628
}
642629

643630
println!();

0 commit comments

Comments
 (0)