Updates for 0.4.0
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by sharkdp · committed by David Peter · parent 2e24ff0 · Browse files · 7 files·+24 added−23 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+24 added−23 removed
- other:+24 added−23 removed
Provenance
- Commit
89e6d37- Tree
1ca23a1- Author
sharkdp <davidpeter@web.de>- Committer
David Peter <sharkdp@users.noreply.github.com>- Parent
2e24ff0
7 files changed+24 added−23 removed
modified:src/hyperfine/benchmark.rs+1 added-1 removed
127 unmodified lines128 /// Run the command specified by `--prepare`.129 fn run_preparation_command(command: &Option<String>) -> io::Result<()> {130 if let &Some(ref preparation_command) = command {131 let res = time_shell_command(preparation_command, CmdFailureAction::RaiseError, None);132- if let Err(_) = res {132+ if res.is_err() {133 return Err(io::Error::new(134 io::ErrorKind::Other,135 "The preparation command terminated with a non-zero exit code. \136 Append ' || true' to the command if you are sure that this can be ignored.",170 unmodified linesmodified:src/hyperfine/internal.rs+8 added-8 removed
60 unmodified lines61 }62 63 /// Return a pre-configured progress bar64 pub fn get_progress_bar(length: u64, msg: &str, option: &OutputStyleOption) -> ProgressBar {65- let progressbar_style = match option {66- &OutputStyleOption::Basic => ProgressStyle::default_bar(),67- &OutputStyleOption::Full => ProgressStyle::default_spinner()68- .tick_chars("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏")69- .template(" {spinner} {msg:<30} {wide_bar} ETA {eta_precise}"),65+ let progressbar_style = match *option {66+ OutputStyleOption::Basic => ProgressStyle::default_bar(),67+ OutputStyleOption::Full => ProgressStyle::default_spinner()68+ .tick_chars("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏")69+ .template(" {spinner} {msg:<30} {wide_bar} ETA {eta_precise}"),70 };71 72- let progress_bar = match option {73- &OutputStyleOption::Basic => ProgressBar::hidden(),74- &OutputStyleOption::Full => ProgressBar::new(length),72+ let progress_bar = match *option {73+ OutputStyleOption::Basic => ProgressBar::hidden(),74+ OutputStyleOption::Full => ProgressBar::new(length),75 };76 progress_bar.set_style(progressbar_style.clone());77 progress_bar.enable_steady_tick(80);78 progress_bar.set_message(msg);26 unmodified linesmodified:src/hyperfine/outlier_detection.rs+4 added-4 removed
11 unmodified lines12 /// of standard deviations.13 pub const OUTLIER_THRESHOLD: f64 = 1.4826 * 10.0;14 15 /// Compute modifized Z-scores for a given sample. A (unmodified) Z-score is defined by16-/// (x_i - x_mean)/x_stddev whereas the modified Z-score is defined by |x_i - x_median|/MAD where17-/// MAD is the median average deviation.16+/// `(x_i - x_mean)/x_stddev` whereas the modified Z-score is defined by `|x_i - x_median|/MAD`17+/// where MAD is the median average deviation.18 ///19 /// References:20-/// - https://en.wikipedia.org/wiki/Median_absolute_deviation20+/// - <https://en.wikipedia.org/wiki/Median_absolute_deviation>21 pub fn modified_zscores(xs: &[f64]) -> Vec<f64> {22 assert!(!xs.is_empty());23 24 // Compute sample median:25- let x_median = median(&xs);25+ let x_median = median(xs);26 27 // Compute the absolute deviations from the median:28 let deviations: Vec<f64> = xs.iter().map(|x| (x - x_median).abs()).collect();29 73 unmodified linesmodified:src/main.rs+3 added-3 removed
105 unmodified lines106 .takes_value(true)107 .value_name("TYPE")108 .possible_values(&["auto", "basic", "full"])109 .help(110- "Set output style type. If set to 'basic', all colors and special \111- formatting will be disabled. If set to 'auto' when output target is not \112- a TTY, 'basic' is used (default: auto).",110+ "Set output style type (default: auto). Set this to 'basic' to disable output \111+ coloring and interactive elements. Set it to 'full' to enable all effects \112+ even if no interactive terminal was detected.",113 ),114 )115 .arg(116 Arg::with_name("ignore-failure")46 unmodified linesmodified:Cargo.lock+4 added-4 removed
93 unmodified lines94 source = "registry+https://github.com/rust-lang/crates.io-index"95 96 [[package]]97 name = "hyperfine"98-version = "0.3.0"98+version = "0.4.0"99 dependencies = [100 "approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",101 "atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",102 "clap 2.29.2 (registry+https://github.com/rust-lang/crates.io-index)",54 unmodified lines157 "num-bigint 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",158 "num-complex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",159 "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",160 "num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",161- "num-rational 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",161+ "num-rational 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",162 "num-traits 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",163 ]164 165 [[package]]34 unmodified lines200 ]201 202 [[package]]203 name = "num-rational"204-version = "0.1.40"204+version = "0.1.41"205 source = "registry+https://github.com/rust-lang/crates.io-index"206 dependencies = [207 "num-bigint 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",208 "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",222 unmodified lines431 "checksum num-bigint 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "bdc1494b5912f088f260b775799468d9b9209ac60885d8186a547a0476289e23"432 "checksum num-complex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "58de7b4bf7cf5dbecb635a5797d489864eadd03b107930cbccf9e0fd7428b47c"433 "checksum num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "d1452e8b06e448a07f0e6ebb0bb1d92b8890eea63288c0b627331d53514d0fba"434 "checksum num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "7485fcc84f85b4ecd0ea527b14189281cf27d60e583ae65ebc9c088b13dffe01"435-"checksum num-rational 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "0c7cb72a95250d8a370105c828f388932373e0e94414919891a0f945222310fe"435+"checksum num-rational 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "0b950f75e042fdd710460084d19c8efdcd72d65183ead8ecd04b90483f5a55d2"436 "checksum num-traits 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "9936036cc70fe4a8b2d338ab665900323290efb03983c86cbe235ae800ad8017"437 "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"438 "checksum parking_lot 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3e7f7c9857874e54afeb950eebeae662b1e51a2493666d2ea4c0a5d91dcf0412"439 "checksum parking_lot_core 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "9f35048d735bb93dd115a0030498785971aab3234d311fbe273d020084d26bd8"24 unmodified linesmodified:Cargo.toml+1 added-1 removed
5 unmodified lines678910101112131411 unmodified lines5 unmodified lineslicense = "MIT/Apache-2.0"name = "hyperfine"readme = "README.md"repository = "https://github.com/sharkdp/hyperfine"version = "0.3.0"version = "0.4.0"
[dependencies]colored = "1.6"indicatif = "0.9"11 unmodified linesmodified:README.md+3 added-2 removed
14 unmodified lines15161718192021222352 unmodified lines7677787979808081828384854 unmodified lines14 unmodified lines* Support for arbitrary shell commands.* Constant feedback about the benchmark progress and current estimates.* Warmup runs can be executed before the actual benchmark.* Cache-clearing commands can be set up before each timing run.* Statisical outlier detection.
## Usage
### Basic benchmark52 unmodified lines
Download the appropriate `.deb` package from the [Release page](https://github.com/sharkdp/hyperfine/releases)and install it via `dpkg`:```wget https://github.com/sharkdp/hyperfine/releases/download/v0.3.0/hyperfine_0.3.0_amd64.debsudo dpkg -i hyperfine_0.3.0_amd64.debwget https://github.com/sharkdp/hyperfine/releases/download/v0.4.0/hyperfine_0.4.0_amd64.debsudo dpkg -i hyperfine_0.4.0_amd64.deb```
## Origin of the name4 unmodified lines