cargo fmt

This commit is contained in:
sharkdp committed 2018-09-27 23:07:24 +02:00
1 parent 156933489b
commit f85e61dc39
5 files changed
+20 -16

No files matched your search

+4 -1
View File
@@ -219,7 +219,10 @@ pub fn run_benchmark(
let count = {
let min = cmp::max(runs_in_min_time, options.runs.min);
options.runs.max.as_ref()
options
.runs
.max
.as_ref()
.map(|max| cmp::min(min, *max))
.unwrap_or(min)
};
+2 -1
View File
@@ -34,6 +34,7 @@ fn add_table_row(dest: &mut Vec<u8>, entry: &BenchmarkResult) {
entry.stddev * MULTIPLIER,
entry.min * MULTIPLIER,
entry.max * MULTIPLIER
).as_bytes(),
)
.as_bytes(),
);
}
+5 -4
View File
@@ -71,12 +71,13 @@ pub fn write_benchmark_comparison(results: &Vec<BenchmarkResult>) {
let ratio = item.mean / fastest_item.mean;
// https://en.wikipedia.org/wiki/Propagation_of_uncertainty#Example_formulas
// Covariance asssumed to be 0, i.e. variables are assumed to be independent
let ratio_stddev = ratio * ( (item.stddev/item.mean).powi(2) + (fastest_item.stddev/fastest_item.mean).powi(2) ).sqrt();
let ratio_stddev = ratio
* ((item.stddev / item.mean).powi(2)
+ (fastest_item.stddev / fastest_item.mean).powi(2))
.sqrt();
println!(
"{} ± {} times faster than '{}'",
format!("{:8.2}", ratio)
.bold()
.green(),
format!("{:8.2}", ratio).bold().green(),
format!("{:.2}", ratio_stddev).green(),
&item.command.magenta()
);
+1 -4
View File
@@ -84,10 +84,7 @@ pub struct Runs {
impl Default for Runs {
fn default() -> Runs {
Runs {
min: 10,
max: None,
}
Runs { min: 10, max: None }
}
}
+8 -6
View File
@@ -42,7 +42,7 @@ mod hyperfine;
use hyperfine::app::get_arg_matches;
use hyperfine::benchmark::{mean_shell_spawning_time, run_benchmark};
use hyperfine::error::{ParameterScanError, OptionsError};
use hyperfine::error::{OptionsError, ParameterScanError};
use hyperfine::export::{ExportManager, ExportType};
use hyperfine::internal::write_benchmark_comparison;
use hyperfine::types::{
@@ -168,11 +168,13 @@ fn build_hyperfine_options(matches: &ArgMatches) -> Result<HyperfineOptions, Opt
Some("full") => OutputStyleOption::Full,
Some("basic") => OutputStyleOption::Basic,
Some("nocolor") => OutputStyleOption::NoColor,
_ => if !options.show_output && atty::is(Stream::Stdout) {
OutputStyleOption::Full
} else {
OutputStyleOption::Basic
},
_ => {
if !options.show_output && atty::is(Stream::Stdout) {
OutputStyleOption::Full
} else {
OutputStyleOption::Basic
}
}
};
// We default Windows to NoColor if full had been specified.