Skip to content
Myr

Addressed review comments.

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

authored by Diogo Sousa · committed by David Peter · parent d78c33b · Browse files · 4 files+12 added−8 removed
This commit

State

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

Diff stats

4 files+12 added−8 removed

  • other:+12 added−8 removed

4 files+12 added−8 removed

modified:src/hyperfine/app.rs+1 added
63 unmodified lines
64 )65 .arg(66 Arg::with_name("runs")67 .long("runs")68 .conflicts_with_all(&["max-runs", "min-runs"])69 .short("r")70 .takes_value(true)71 .value_name("NUM")72 .help("Perform exactly NUM runs for each command."),
79 unmodified lines
modified:src/hyperfine/benchmark.rs+7 added-4 removed
214 unmodified lines
215 let runs_in_min_time = (options.min_time_sec216 / (res.time_real + prepare_res.time_real + shell_spawning_time.time_real))217 as u64;218219 let count = cmp::min(220 cmp::max(runs_in_min_time, options.runs.min),221 options.runs.max222 );219 let count = {220 let min = cmp::max(runs_in_min_time, options.runs.min);221222 options.runs.max.as_ref()223 .map(|max| cmp::min(min, *max))224 .unwrap_or(min)225 };226227 let count_remaining = count - 1;228229 // Save the first result230 times_real.push(res.time_real);
114 unmodified lines
modified:src/hyperfine/types.rs+2 added-2 removed
77 unmodified lines
78 /// Minimum number of benchmark runs79 pub min: u64,8081 /// Maximum number of benchmark runs82 pub max: u64,82 pub max: Option<u64>,83}8485impl Default for Runs {86 fn default() -> Runs {87 Runs {88 min: 10,89 max: ::std::u64::MAX,89 max: None,90 }91 }92}93
91 unmodified lines
modified:src/main.rs+2 added-2 removed
146 unmodified lines
147 }148 (None, Some(max)) => {149 // Since the minimum was not explicit we lower it if max is below the default min.150 options.runs.min = cmp::min(options.runs.min, max);151 options.runs.max = max;151 options.runs.max = Some(max);152 }153 (Some(min), Some(max)) if min > max => {154 return Err(OptionsError::EmptyRunsRange);155 }156 (Some(min), Some(max)) => {157 options.runs.min = min;158 options.runs.max = max;158 options.runs.max = Some(max);159 }160 (None, None) => {}161 };162
70 unmodified lines