Skip to content

Commit

Permalink
Updates for 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp committed Jan 28, 2018
1 parent 2e24ff0 commit 2859150
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 23 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
```


Expand Down
2 changes: 1 addition & 1 deletion src/hyperfine/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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. \
Expand Down
16 changes: 8 additions & 8 deletions src/hyperfine/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/hyperfine/outlier_detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 2859150

Please sign in to comment.