Skip to content
Myr

Compute and print standard deviation of the speed ratio

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sergey "Shnatsel" Davidoff · committed by David Peter · parent 0466a1d · Browse files · 1 file+7 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−2 removed

  • other:+7 added−2 removed

1 file+7 added−2 removed

modified:src/hyperfine/internal.rs+7 added-2 removed
66 unmodified lines
67 println!(" '{}' ran", fastest_item.command.cyan());68 longer_items.sort_by(|l, r| l.mean.partial_cmp(&r.mean).unwrap_or(Ordering::Equal));6970 for item in longer_items {71 let ratio = item.mean / fastest_item.mean;72 // https://en.wikipedia.org/wiki/Propagation_of_uncertainty#Example_formulas73 // Covariance asssumed to be 0, i.e. variables are assumed to be independent74 let ratio_stddev = ratio * ( (item.stddev/item.mean).powi(2) + (fastest_item.stddev/fastest_item.mean).powi(2) ).sqrt();75 println!(72 "{} faster than '{}'",73 format!("{:8.2}x", item.mean / fastest_item.mean)76 "{} ± {} faster than '{}'",77 format!("{:8.2}x", ratio)78 .bold()79 .green(),80 format!("{:.2}", ratio_stddev).green(),81 &item.command.magenta()82 );83 }84}
9 unmodified lines