summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock8
-rw-r--r--Cargo.toml2
-rw-r--r--README.md5
-rw-r--r--src/hyperfine/benchmark.rs2
-rw-r--r--src/hyperfine/internal.rs16
-rw-r--r--src/hyperfine/outlier_detection.rs8
-rw-r--r--src/main.rs6
7 files changed, 24 insertions, 23 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 2cf433c..9d8cbe5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -95,7 +95,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "hyperfine"
-version = "0.3.0"
+version = "0.4.0"
dependencies = [
"approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -158,7 +158,7 @@ dependencies = [
"num-complex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-rational 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-rational 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -201,7 +201,7 @@ dependencies = [
[[package]]
name = "num-rational"
-version = "0.1.40"
+version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num-bigint 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -432,7 +432,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum num-complex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "58de7b4bf7cf5dbecb635a5797d489864eadd03b107930cbccf9e0fd7428b47c"
"checksum num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "d1452e8b06e448a07f0e6ebb0bb1d92b8890eea63288c0b627331d53514d0fba"
"checksum num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "7485fcc84f85b4ecd0ea527b14189281cf27d60e583ae65ebc9c088b13dffe01"
-"checksum num-rational 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "0c7cb72a95250d8a370105c828f388932373e0e94414919891a0f945222310fe"
+"checksum num-rational 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "0b950f75e042fdd710460084d19c8efdcd72d65183ead8ecd04b90483f5a55d2"
"checksum num-traits 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "9936036cc70fe4a8b2d338ab665900323290efb03983c86cbe235ae800ad8017"
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
"checksum parking_lot 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3e7f7c9857874e54afeb950eebeae662b1e51a2493666d2ea4c0a5d91dcf0412"
diff --git a/Cargo.toml b/Cargo.toml
index 2a82972..a00143e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,7 +7,7 @@ license = "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"
diff --git a/README.md b/README.md
index 4df0ae4..a4441fe 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,7 @@ A command-line benchmarking tool (*inspired by [bench](https://github.com/Gabrie
* 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
@@ -76,8 +77,8 @@ yaourt -S hyperfine
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.deb
-sudo dpkg -i hyperfine_0.3.0_amd64.deb
+wget https://github.com/sharkdp/hyperfine/releases/download/v0.4.0/hyperfine_0.4.0_amd64.deb
+sudo dpkg -i hyperfine_0.4.0_amd64.deb
```
diff --git a/src/hyperfine/benchmark.rs b/src/hyperfine/benchmark.rs
index 304473c..4b65799 100644
--- a/src/hyperfine/benchmark.rs
+++ b/src/hyperfine/benchmark.rs
@@ -129,7 +129,7 @@ pub fn mean_shell_spawning_time(style: &OutputStyleOption) -> io::Result<TimingR
fn run_preparation_command(command: &Option<String>) -> io::Result<()> {
if let &Some(ref preparation_command) = command {
let res = time_shell_command(preparation_command, CmdFailureAction::RaiseError, None);
- if let Err(_) = res {
+ if res.is_err() {
return Err(io::Error::new(
io::ErrorKind::Other,
"The preparation command terminated with a non-zero exit code. \
diff --git a/src/hyperfine/internal.rs b/src/hyperfine/internal.rs
index f385a21..d802ca7 100644
--- a/src/hyperfine/internal.rs
+++ b/src/hyperfine/internal.rs
@@ -62,16 +62,16 @@ impl Default for HyperfineOptions {
/// Return a pre-configured progress bar
pub fn get_progress_bar(length: u64, msg: &str, option: &OutputStyleOption) -> ProgressBar {
- let progressbar_style = match option {
- &OutputStyleOption::Basic => ProgressStyle::default_bar(),
- &OutputStyleOption::Full => ProgressStyle::default_spinner()
- .tick_chars("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏")
- .template(" {spinner} {msg:<30} {wide_bar} ETA {eta_precise}"),
+ let progressbar_style = match *option {
+ OutputStyleOption::Basic => ProgressStyle::default_bar(),
+ OutputStyleOption::Full => ProgressStyle::default_spinner()
+ .tick_chars("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏")
+ .template(" {spinner} {msg:<30} {wide_bar} ETA {eta_precise}"),
};
- let progress_bar = match option {
- &OutputStyleOption::Basic => ProgressBar::hidden(),
- &OutputStyleOption::Full => ProgressBar::new(length),
+ let progress_bar = match *option {
+ OutputStyleOption::Basic => ProgressBar::hidden(),
+ OutputStyleOption::Full => ProgressBar::new(length),
};
progress_bar.set_style(progressbar_style.clone());
progress_bar.enable_steady_tick(80);
diff --git a/src/hyperfine/outlier_detection.rs b/src/hyperfine/outlier_detection.rs
index 58cb98e..23e5b99 100644
--- a/src/hyperfine/outlier_detection.rs
+++ b/src/hyperfine/outlier_detection.rs
@@ -13,16 +13,16 @@ use statistical::median;
pub const OUTLIER_THRESHOLD: f64 = 1.4826 * 10.0;
/// Compute modifized Z-scores for a given sample. A (unmodified) Z-score is defined by
-/// (x_i - x_mean)/x_stddev whereas the modified Z-score is defined by |x_i - x_median|/MAD where
-/// MAD is the median average deviation.
+/// `(x_i - x_mean)/x_stddev` whereas the modified Z-score is defined by `|x_i - x_median|/MAD`
+/// where MAD is the median average deviation.
///
/// References:
-/// - https://en.wikipedia.org/wiki/Median_absolute_deviation
+/// - <https://en.wikipedia.org/wiki/Median_absolute_deviation>
pub fn modified_zscores(xs: &[f64]) -> Vec<f64> {
assert!(!xs.is_empty());
// Compute sample median:
- let x_median = median(&xs);
+ let x_median = median(xs);
// Compute the absolute deviations from the median:
let deviations: Vec<f64> = xs.iter().map(|x| (x - x_median).abs()).collect();
diff --git a/src/main.rs b/src/main.rs
index 15b3777..da63489 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -107,9 +107,9 @@ fn main() {
.value_name("TYPE")
.possible_values(&["auto", "basic", "full"])
.help(
- "Set output style type. If set to 'basic', all colors and special \
- formatting will be disabled. If set to 'auto' when output target is not \
- a TTY, 'basic' is used (default: auto).",
+ "Set output style type (default: auto). Set this to 'basic' to disable output \
+ coloring and interactive elements. Set it to 'full' to enable all effects \
+ even if no interactive terminal was detected.",
),
)
.arg(