From f7fd95590caf63b5cf8d501ddb0facb3ec6fa7a3 Mon Sep 17 00:00:00 2001 From: Nicholas L <nicholas-l@users.noreply.github.com> Date: Tue, 27 Oct 2020 19:24:11 +0000 Subject: [PATCH 1/4] Add median to the end of output --- src/hyperfine/benchmark.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/hyperfine/benchmark.rs b/src/hyperfine/benchmark.rs index 446d75de5..33e74801a 100644 --- a/src/hyperfine/benchmark.rs +++ b/src/hyperfine/benchmark.rs @@ -362,6 +362,7 @@ pub fn run_benchmark( let (mean_str, unit_mean) = format_duration_unit(t_mean, options.time_unit); let stddev_str = format_duration(t_stddev, Some(unit_mean)); let min_str = format_duration(t_min, Some(unit_mean)); + let median_str = format_duration(t_median, Some(unit_mean)); let max_str = format_duration(t_max, Some(unit_mean)); let num_str = format!("{} runs", t_num); @@ -379,11 +380,23 @@ pub fn run_benchmark( system_str.blue() ); + // println!( + // " Range ({} … {} … {}): {:>8} … {:>8} … {:>8} {}", + // "min".cyan(), + // "median".blue(), + // "max".purple(), + // min_str.cyan(), + // median_str.blue(), + // max_str.purple(), + // num_str.dimmed() + // ); + println!( - " Range ({} … {}): {:>8} … {:>8} {}", + " Range ({} … {}): {:>8} … {:>8} (median: {}) {:>10}", "min".cyan(), "max".purple(), min_str.cyan(), + median_str.blue(), max_str.purple(), num_str.dimmed() ); From bb84f8767f49dd2f6ac431ec7d622dc038166b75 Mon Sep 17 00:00:00 2001 From: Nicholas L <nicholas-l@users.noreply.github.com> Date: Tue, 27 Oct 2020 19:26:41 +0000 Subject: [PATCH 2/4] Remove commented out code --- src/hyperfine/benchmark.rs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/hyperfine/benchmark.rs b/src/hyperfine/benchmark.rs index 33e74801a..b061794f0 100644 --- a/src/hyperfine/benchmark.rs +++ b/src/hyperfine/benchmark.rs @@ -380,17 +380,6 @@ pub fn run_benchmark( system_str.blue() ); - // println!( - // " Range ({} … {} … {}): {:>8} … {:>8} … {:>8} {}", - // "min".cyan(), - // "median".blue(), - // "max".purple(), - // min_str.cyan(), - // median_str.blue(), - // max_str.purple(), - // num_str.dimmed() - // ); - println!( " Range ({} … {}): {:>8} … {:>8} (median: {}) {:>10}", "min".cyan(), From 587b0929ce34d3aecac515477acf08b77c42de2b Mon Sep 17 00:00:00 2001 From: Nicholas L <nicholas-l@users.noreply.github.com> Date: Tue, 27 Oct 2020 19:38:18 +0000 Subject: [PATCH 3/4] FIx max instead of median --- src/hyperfine/benchmark.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hyperfine/benchmark.rs b/src/hyperfine/benchmark.rs index b061794f0..4b684ad1a 100644 --- a/src/hyperfine/benchmark.rs +++ b/src/hyperfine/benchmark.rs @@ -385,8 +385,8 @@ pub fn run_benchmark( "min".cyan(), "max".purple(), min_str.cyan(), - median_str.blue(), max_str.purple(), + median_str.blue(), num_str.dimmed() ); } From 90d78ee38411b03c92b4d5f5db0575a9aa1eb3dd Mon Sep 17 00:00:00 2001 From: Nicholas L <nicholas-l@users.noreply.github.com> Date: Tue, 27 Oct 2020 20:15:48 +0000 Subject: [PATCH 4/4] Make median as yellow and move to between min and max --- src/hyperfine/benchmark.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hyperfine/benchmark.rs b/src/hyperfine/benchmark.rs index 4b684ad1a..26855abe6 100644 --- a/src/hyperfine/benchmark.rs +++ b/src/hyperfine/benchmark.rs @@ -371,7 +371,7 @@ pub fn run_benchmark( if options.output_style != OutputStyleOption::Disabled { println!( - " Time ({} ± {}): {:>8} ± {:>8} [User: {}, System: {}]", + " Time {} ± {}: {:>8} ± {:>8} [User: {}, System: {}]", "mean".green().bold(), "σ".green(), mean_str.green().bold(), @@ -381,12 +381,13 @@ pub fn run_benchmark( ); println!( - " Range ({} … {}): {:>8} … {:>8} (median: {}) {:>10}", + " {} … {} … {}: {:>8} … {:>8} … {:>8} {:>10}", "min".cyan(), + "median".yellow(), "max".purple(), min_str.cyan(), + median_str.yellow(), max_str.purple(), - median_str.blue(), num_str.dimmed() ); }