mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-20 11:21:39 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b089eda3a3 | ||
|
|
5637af48ba | ||
|
|
d83d9ffd0d | ||
|
|
6267a26ccb | ||
|
|
2f51d22e4d | ||
|
|
0ba8a20bb8 | ||
|
|
51fe31e7d2 | ||
|
|
266105b52c | ||
|
|
4298c83028 | ||
|
|
e16b7305d7 | ||
|
|
fb914c41db | ||
|
|
048506bed4 | ||
|
|
1dcefd9082 | ||
|
|
c540aab8e3 | ||
|
|
8f0c0209e8 | ||
|
|
ebc2ea6d6d | ||
|
|
a4cf1eaa29 | ||
|
|
3144c4b96c | ||
|
|
e95af1cd0e | ||
|
|
b7747abbdd | ||
|
|
3aa26a3e27 | ||
|
|
f0b6f130ea | ||
|
|
1ec810f8d4 | ||
|
|
caa9c4e9f1 | ||
|
|
440ec41291 | ||
|
|
ac649fdaa7 | ||
|
|
01581f60e0 | ||
|
|
0b18446c0c | ||
|
|
29804c54c9 | ||
|
|
f1d4443416 | ||
|
|
4c814f6142 |
No files matched your search
@@ -0,0 +1,27 @@
|
||||
name: hyperfine
|
||||
version: git
|
||||
summary: "A command-line benchmarking tool"
|
||||
description: |
|
||||
A command-line benchmarking tool (inspired by bench).
|
||||
Features
|
||||
* Statistical analysis across multiple runs.
|
||||
* 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.
|
||||
* Statistical outlier detection.
|
||||
* Export results to various formats: CSV, JSON, Markdown.
|
||||
* Parameterized benchmarks.
|
||||
* Cross-platform
|
||||
|
||||
grade: stable
|
||||
confinement: classic
|
||||
|
||||
parts:
|
||||
hyperfine:
|
||||
plugin: rust
|
||||
source: ./
|
||||
|
||||
apps:
|
||||
hyperfine:
|
||||
command: bin/hyperfine
|
||||
Generated
+88
-82
@@ -1,9 +1,9 @@
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.6.8"
|
||||
version = "0.6.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -39,7 +39,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@@ -80,7 +80,7 @@ name = "colored"
|
||||
version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -90,11 +90,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"termios 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -105,7 +105,7 @@ version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"csv-core 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -113,7 +113,7 @@ name = "csv-core"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -132,19 +132,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "hyperfine"
|
||||
version = "1.3.0"
|
||||
version = "1.5.0"
|
||||
dependencies = [
|
||||
"approx 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"colored 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"csv 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"indicatif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"statistical 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -181,11 +181,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
@@ -194,19 +191,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.1.0"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -279,7 +276,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "owning_ref"
|
||||
version = "0.3.3"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -290,7 +287,7 @@ name = "parking_lot"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -302,13 +299,13 @@ dependencies = [
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "0.4.19"
|
||||
version = "0.4.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -316,10 +313,10 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.6.8"
|
||||
version = "0.6.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -350,18 +347,26 @@ dependencies = [
|
||||
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.40"
|
||||
version = "0.1.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@@ -369,7 +374,7 @@ name = "redox_termios"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -377,23 +382,23 @@ name = "regex"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.0.5"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -401,15 +406,15 @@ name = "regex-syntax"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.2"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -427,7 +432,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "0.2.6"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@@ -450,32 +455,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.79"
|
||||
version = "1.0.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.79"
|
||||
version = "1.0.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.31"
|
||||
version = "1.0.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "0.6.5"
|
||||
version = "0.6.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -502,11 +507,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.15.6"
|
||||
version = "0.15.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -526,13 +531,13 @@ version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termios"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -552,12 +557,12 @@ name = "thread_local"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ucd-util"
|
||||
version = "0.1.1"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@@ -580,7 +585,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "utf8-ranges"
|
||||
version = "1.0.1"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@@ -623,12 +628,12 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[metadata]
|
||||
"checksum aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "68f56c7353e5a9547cbd76ed90f7bb5ffc3ba09d4ea9bd1d8c06c8b1142eeb5a"
|
||||
"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e"
|
||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
"checksum approx 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f71f10b5c4946a64aad7b8cf65e3406cd3da22fc448595991d22423cf6db67b4"
|
||||
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
|
||||
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
|
||||
"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3"
|
||||
"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
|
||||
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
|
||||
"checksum clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f84dec9bc083ce2503908cd305af98bd363da6f54bf8d4bf0ac14ee749ad5d1"
|
||||
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
|
||||
@@ -642,10 +647,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
|
||||
"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7"
|
||||
"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
|
||||
"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
|
||||
"checksum lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775751a3e69bde4df9b38dd00a1b5d6ac13791e4223d4a0506577f0dd27cfb7a"
|
||||
"checksum memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b3629fe9fdbff6daa6c33b90f7c08355c1aca05a3d01fa8063b822fcf185f3b"
|
||||
"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
|
||||
"checksum memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a3eb002f0535929f1199681417029ebea04aadc0c7a4224b46be99c7f5d6a16"
|
||||
"checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e"
|
||||
"checksum num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e63899ad0da84ce718c14936262a41cee2c79c981fc0a0e7c7beb47d5a07e8c1"
|
||||
"checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656"
|
||||
@@ -653,45 +658,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum num-iter 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "af3fdbbc3291a5464dc57b03860ec37ca6bf915ed6ee385e7c6c052c422b2124"
|
||||
"checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e"
|
||||
"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"
|
||||
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
|
||||
"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13"
|
||||
"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5"
|
||||
"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c"
|
||||
"checksum proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "ffe022fb8c8bd254524b0b3305906c1921fa37a84a644e29079a9e62200c3901"
|
||||
"checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5"
|
||||
"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09"
|
||||
"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
|
||||
"checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1"
|
||||
"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd"
|
||||
"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c"
|
||||
"checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2"
|
||||
"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1"
|
||||
"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372"
|
||||
"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db"
|
||||
"checksum redox_syscall 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "cf8fb82a4d1c9b28f1c26c574a5b541f5ffb4315f6c9a791fa47b6a04438fe93"
|
||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||
"checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384"
|
||||
"checksum regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2069749032ea3ec200ca51e4a31df41759190a88edca0d2d86ee8bedf7073341"
|
||||
"checksum regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ee84f70c8c08744ea9641a731c7fadb475bf2ecc52d7f627feb833e0b3990467"
|
||||
"checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7"
|
||||
"checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d"
|
||||
"checksum regex-syntax 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fbc557aac2b708fe84121caf261346cc2eed71978024337e42eb46b8a252ac6e"
|
||||
"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
|
||||
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||
"checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7"
|
||||
"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7"
|
||||
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
|
||||
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
"checksum serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "84257ccd054dc351472528c8587b4de2dbf0dc0fe2e634030c1a90bfdacebaa9"
|
||||
"checksum serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "31569d901045afbff7a9479f793177fe9259819aff10ab4f89ef69bbc5f567fe"
|
||||
"checksum serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "bb47a3d5c84320222f66d7db21157c4a7407755de41798f9b4c1c40593397b1a"
|
||||
"checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d"
|
||||
"checksum serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)" = "6fa52f19aee12441d5ad11c9a00459122bd8f98707cadf9778c540674f1935b6"
|
||||
"checksum serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)" = "96a7f9496ac65a2db5929afa087b54f8fc5008dcfbe48a8874ed20049b0d6154"
|
||||
"checksum serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "c37ccd6be3ed1fdf419ee848f7c758eb31b054d7cd3ae3600e3bae0adf569811"
|
||||
"checksum smallvec 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "622df2d454c29a4d89b30dc3b27b42d7d90d6b9e587dbf8f67652eb7514da484"
|
||||
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
||||
"checksum statistical 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c139942f46d96c53b28420a2cdfb374629f122656bd9daef7fc221ed4d8ec228"
|
||||
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
|
||||
"checksum syn 0.15.6 (registry+https://github.com/rust-lang/crates.io-index)" = "854b08a640fc8f54728fb95321e3ec485b365a97fe47609797c671addd1dde69"
|
||||
"checksum syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)" = "ae8b29eb5210bc5cf63ed6149cbf9adfc82ac0be023d8735c176ee74a2db4da7"
|
||||
"checksum term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e5b9a66db815dcfd2da92db471106457082577c3c278d4138ab3e3b4e189327"
|
||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||
"checksum termios 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70226acdf12d182df757d9fb07c0257a1558ec48c8059f607d6b38145ce4e2fa"
|
||||
"checksum termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625"
|
||||
"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
|
||||
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
|
||||
"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d"
|
||||
"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86"
|
||||
"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
|
||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
|
||||
"checksum utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd70f467df6810094968e2fce0ee1bd0e87157aceb026a8c083bcf5e25b9efe4"
|
||||
"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737"
|
||||
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
|
||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
|
||||
+5
-5
@@ -7,18 +7,18 @@ license = "MIT/Apache-2.0"
|
||||
name = "hyperfine"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/sharkdp/hyperfine"
|
||||
version = "1.3.0"
|
||||
version = "1.5.0"
|
||||
|
||||
[dependencies]
|
||||
colored = "1.6"
|
||||
indicatif = "0.9"
|
||||
statistical = "0.1"
|
||||
atty = "0.2.2"
|
||||
cfg-if = "0.1.2"
|
||||
cfg-if = "0.1.6"
|
||||
csv = "1.0.0"
|
||||
serde = "1.0.33"
|
||||
serde_derive = "1.0.33"
|
||||
serde_json = "1.0.11"
|
||||
serde = "1.0.82"
|
||||
serde_derive = "1.0.82"
|
||||
serde_json = "1.0.33"
|
||||
|
||||
[target.'cfg(not(windows))'.dependencies]
|
||||
libc = "0.2"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
[](https://travis-ci.org/sharkdp/hyperfine)
|
||||
[](https://ci.appveyor.com/project/sharkdp/hyperfine)
|
||||
[](https://crates.io/crates/hyperfine)
|
||||
[中文](https://github.com/chinanf-boy/hyperfine-zh)
|
||||
|
||||
A command-line benchmarking tool (*inspired by [bench](https://github.com/Gabriel439/bench)*).
|
||||
|
||||
@@ -82,6 +83,9 @@ option that will create tables like this:
|
||||
| `find . -iname '*[0-9].jpg'` | 304.9 ± 3.1 | 299.8…309.3 |
|
||||
| `fd -HI '.*[0-9]\.jpg$'` | 66.2 ± 5.8 | 62.5…86.3 |
|
||||
|
||||
The JSON output is useful if you want to analyze the benchmark results in more detail. See the
|
||||
[`scripts/`](https://github.com/sharkdp/hyperfine/tree/master/scripts) folder for some examples.
|
||||
|
||||
## Installation
|
||||
|
||||
### On macOS
|
||||
@@ -96,8 +100,8 @@ brew install 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/v1.3.0/hyperfine_1.3.0_amd64.deb
|
||||
sudo dpkg -i hyperfine_1.3.0_amd64.deb
|
||||
wget https://github.com/sharkdp/hyperfine/releases/download/v1.4.0/hyperfine_1.4.0_amd64.deb
|
||||
sudo dpkg -i hyperfine_1.4.0_amd64.deb
|
||||
```
|
||||
|
||||
### On Arch Linux
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
This folder contains scripts that can be used in combination with hyperfines `--export-json` option.
|
||||
|
||||
### Example:
|
||||
|
||||
``` bash
|
||||
> hyperfine 'sleep 0.020' 'sleep 0.021' 'sleep 0.022' --export-json sleep.json
|
||||
> python plot_benchmark_results.py sleep.json
|
||||
```
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import numpy as np
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("file", help="JSON file with benchmark results")
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.file) as f:
|
||||
results = json.load(f)["results"]
|
||||
|
||||
commands = [b["command"] for b in results]
|
||||
times = [b["times"] for b in results]
|
||||
|
||||
for command, ts in zip(commands, times):
|
||||
p05 = np.percentile(ts, 5)
|
||||
p25 = np.percentile(ts, 25)
|
||||
p75 = np.percentile(ts, 75)
|
||||
p95 = np.percentile(ts, 95)
|
||||
|
||||
iqr = p75 - p25
|
||||
|
||||
print("Command '{}'".format(command))
|
||||
print(" mean: {:8.3f} s".format(np.mean(ts)))
|
||||
print(" stddev: {:8.3f} s".format(np.std(ts, ddof=1)))
|
||||
print(" median: {:8.3f} s".format(np.median(ts)))
|
||||
print()
|
||||
print(" percentiles:")
|
||||
print(" P_05 .. P_95: {:.3f} s .. {:.3f} s".format(p05, p95))
|
||||
print(" P_25 .. P_75: {:.3f} s .. {:.3f} s "
|
||||
"(IQR = {:.3f} s)".format(p25, p75, iqr))
|
||||
print()
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("file", help="JSON file with benchmark results")
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.file) as f:
|
||||
results = json.load(f)["results"]
|
||||
|
||||
commands = [b["command"] for b in results]
|
||||
times = [b["times"] for b in results]
|
||||
|
||||
plt.boxplot(times, labels=commands)
|
||||
plt.ylabel("Time [s]")
|
||||
plt.ylim(0, None)
|
||||
plt.show()
|
||||
+25
-7
@@ -86,13 +86,13 @@ fn build_app() -> App<'static, 'static> {
|
||||
Arg::with_name("parameter-scan")
|
||||
.long("parameter-scan")
|
||||
.short("P")
|
||||
.takes_value(true)
|
||||
.allow_hyphen_values(true)
|
||||
.value_names(&["VAR", "MIN", "MAX"])
|
||||
.help(
|
||||
"Perform benchmark runs for each value in the range MIN..MAX. Replaces the \
|
||||
string '{VAR}' in each command by the current parameter value.",
|
||||
)
|
||||
.takes_value(true)
|
||||
.allow_hyphen_values(true)
|
||||
.value_names(&["VAR", "MIN", "MAX"]),
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("style")
|
||||
@@ -109,32 +109,50 @@ fn build_app() -> App<'static, 'static> {
|
||||
the colors without any interactive output.",
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("shell")
|
||||
.long("shell")
|
||||
.short("S")
|
||||
.takes_value(true)
|
||||
.value_name("SHELL")
|
||||
.overrides_with("shell")
|
||||
.help("Set the shell to use (default: sh) for executing benchmarked commands."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("ignore-failure")
|
||||
.long("ignore-failure")
|
||||
.short("i")
|
||||
.help("Ignore non-zero exit codes."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("time-unit")
|
||||
.long("time-unit")
|
||||
.short("u")
|
||||
.takes_value(true)
|
||||
.value_name("UNIT")
|
||||
.possible_values(&["millisecond", "second"])
|
||||
.help("Set the time unit used. Possible values: millisecond, second."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("export-csv")
|
||||
.long("export-csv")
|
||||
.takes_value(true)
|
||||
.value_name("FILE")
|
||||
.help("Export the timing results as CSV to the given FILE."),
|
||||
.help("Export the timing summary statistics as CSV to the given FILE."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("export-json")
|
||||
.long("export-json")
|
||||
.takes_value(true)
|
||||
.value_name("FILE")
|
||||
.help("Export the timing results as JSON to the given FILE."),
|
||||
.help("Export the timing summary statistics and timings of individual runs as JSON to the given FILE."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("export-markdown")
|
||||
.long("export-markdown")
|
||||
.takes_value(true)
|
||||
.value_name("FILE")
|
||||
.help("Export the timing results as a Markdown table to the given FILE."),
|
||||
.help("Export the timing summary statistics as a Markdown table to the given FILE."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("show-output")
|
||||
|
||||
+42
-15
@@ -11,8 +11,10 @@ use hyperfine::outlier_detection::{modified_zscores, OUTLIER_THRESHOLD};
|
||||
use hyperfine::shell::execute_and_time;
|
||||
use hyperfine::timer::wallclocktimer::WallClockTimer;
|
||||
use hyperfine::timer::{TimerStart, TimerStop};
|
||||
use hyperfine::types::{BenchmarkResult, Command};
|
||||
use hyperfine::types::{CmdFailureAction, HyperfineOptions, OutputStyleOption, Second};
|
||||
use hyperfine::types::{
|
||||
BenchmarkResult, CmdFailureAction, Command, HyperfineOptions, OutputStyleOption,
|
||||
};
|
||||
use hyperfine::units::Second;
|
||||
use hyperfine::warnings::Warnings;
|
||||
|
||||
/// Results from timing a single shell command
|
||||
@@ -39,6 +41,7 @@ fn subtract_shell_spawning_time(time: Second, shell_spawning_time: Second) -> Se
|
||||
|
||||
/// Run the given shell command and measure the execution time
|
||||
pub fn time_shell_command(
|
||||
shell: &str,
|
||||
command: &Command,
|
||||
show_output: bool,
|
||||
failure_action: CmdFailureAction,
|
||||
@@ -51,7 +54,7 @@ pub fn time_shell_command(
|
||||
} else {
|
||||
(Stdio::null(), Stdio::null())
|
||||
};
|
||||
let result = execute_and_time(stdout, stderr, &command.get_shell_command())?;
|
||||
let result = execute_and_time(stdout, stderr, &command.get_shell_command(), shell)?;
|
||||
|
||||
let mut time_user = result.user_time;
|
||||
let mut time_system = result.system_time;
|
||||
@@ -86,6 +89,7 @@ pub fn time_shell_command(
|
||||
|
||||
/// Measure the average shell spawning time
|
||||
pub fn mean_shell_spawning_time(
|
||||
shell: &str,
|
||||
style: &OutputStyleOption,
|
||||
show_output: bool,
|
||||
) -> io::Result<TimingResult> {
|
||||
@@ -99,6 +103,7 @@ pub fn mean_shell_spawning_time(
|
||||
for _ in 0..COUNT {
|
||||
// Just run the shell without any command
|
||||
let res = time_shell_command(
|
||||
shell,
|
||||
&Command::new(""),
|
||||
show_output,
|
||||
CmdFailureAction::RaiseError,
|
||||
@@ -107,11 +112,20 @@ pub fn mean_shell_spawning_time(
|
||||
|
||||
match res {
|
||||
Err(_) => {
|
||||
let shell_cmd = if cfg!(windows) {
|
||||
format!("{} /C \"\"", shell)
|
||||
} else {
|
||||
format!("{} -c \"\"", shell)
|
||||
};
|
||||
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
"Could not measure shell execution time. \
|
||||
Make sure you can run 'sh -c \"\"'.",
|
||||
))
|
||||
format!(
|
||||
"Could not measure shell execution time. \
|
||||
Make sure you can run '{}'.",
|
||||
shell_cmd
|
||||
),
|
||||
));
|
||||
}
|
||||
Ok((r, _)) => {
|
||||
times_real.push(r.time_real);
|
||||
@@ -132,11 +146,12 @@ pub fn mean_shell_spawning_time(
|
||||
|
||||
/// Run the command specified by `--prepare`.
|
||||
fn run_preparation_command(
|
||||
shell: &str,
|
||||
command: &Option<Command>,
|
||||
show_output: bool,
|
||||
) -> io::Result<TimingResult> {
|
||||
if let &Some(ref cmd) = command {
|
||||
let res = time_shell_command(cmd, show_output, CmdFailureAction::RaiseError, None);
|
||||
let res = time_shell_command(shell, cmd, show_output, CmdFailureAction::RaiseError, None);
|
||||
if res.is_err() {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
@@ -179,7 +194,13 @@ pub fn run_benchmark(
|
||||
);
|
||||
|
||||
for _ in 0..options.warmup_count {
|
||||
let _ = time_shell_command(cmd, options.show_output, options.failure_action, None)?;
|
||||
let _ = time_shell_command(
|
||||
&options.shell,
|
||||
cmd,
|
||||
options.show_output,
|
||||
options.failure_action,
|
||||
None,
|
||||
)?;
|
||||
progress_bar.inc(1);
|
||||
}
|
||||
progress_bar.finish_and_clear();
|
||||
@@ -200,10 +221,11 @@ pub fn run_benchmark(
|
||||
Some((param, value)) => Command::new_parametrized(preparation_command, param, value),
|
||||
None => Command::new(preparation_command),
|
||||
});
|
||||
let prepare_res = run_preparation_command(&prepare_cmd, options.show_output)?;
|
||||
let prepare_res = run_preparation_command(&options.shell, &prepare_cmd, options.show_output)?;
|
||||
|
||||
// Initial timing run
|
||||
let (res, success) = time_shell_command(
|
||||
&options.shell,
|
||||
cmd,
|
||||
options.show_output,
|
||||
options.failure_action,
|
||||
@@ -236,19 +258,21 @@ pub fn run_benchmark(
|
||||
all_succeeded = all_succeeded && success;
|
||||
|
||||
// Re-configure the progress bar
|
||||
progress_bar.set_length(count_remaining);
|
||||
progress_bar.set_length(count);
|
||||
progress_bar.inc(1);
|
||||
|
||||
// Gather statistics
|
||||
for _ in 0..count_remaining {
|
||||
run_preparation_command(&prepare_cmd, options.show_output)?;
|
||||
run_preparation_command(&options.shell, &prepare_cmd, options.show_output)?;
|
||||
|
||||
let msg = {
|
||||
let mean = format_duration(mean(×_real), None);
|
||||
let mean = format_duration(mean(×_real), options.time_unit);
|
||||
format!("Current estimate: {}", mean.to_string().green())
|
||||
};
|
||||
progress_bar.set_message(&msg);
|
||||
|
||||
let (res, success) = time_shell_command(
|
||||
&options.shell,
|
||||
cmd,
|
||||
options.show_output,
|
||||
options.failure_action,
|
||||
@@ -266,6 +290,7 @@ pub fn run_benchmark(
|
||||
progress_bar.finish_and_clear();
|
||||
|
||||
// Compute statistical quantities
|
||||
let t_num = times_real.len();
|
||||
let t_mean = mean(×_real);
|
||||
let t_stddev = standard_deviation(×_real, Some(t_mean));
|
||||
let t_min = min(×_real);
|
||||
@@ -275,10 +300,11 @@ pub fn run_benchmark(
|
||||
let system_mean = mean(×_system);
|
||||
|
||||
// Formatting and console output
|
||||
let (mean_str, unit_mean) = format_duration_unit(t_mean, None);
|
||||
let (mean_str, unit_mean) = format_duration_unit(t_mean, options.time_unit);
|
||||
let stddev_str = format_duration(t_stddev, Some(unit_mean));
|
||||
let min_str = format_duration(t_min, Some(unit_mean));
|
||||
let max_str = format_duration(t_max, Some(unit_mean));
|
||||
let num_str = format!("{} runs", t_num);
|
||||
|
||||
let (user_str, user_unit) = format_duration_unit(user_mean, None);
|
||||
let system_str = format_duration(system_mean, Some(user_unit));
|
||||
@@ -294,11 +320,12 @@ pub fn run_benchmark(
|
||||
);
|
||||
|
||||
println!(
|
||||
" Range ({} … {}): {:>8} … {:>8}",
|
||||
" Range ({} … {}): {:>8} … {:>8} {}",
|
||||
"min".cyan(),
|
||||
"max".purple(),
|
||||
min_str.cyan(),
|
||||
max_str.purple()
|
||||
max_str.purple(),
|
||||
num_str.dimmed()
|
||||
);
|
||||
|
||||
// Warnings
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use super::Exporter;
|
||||
|
||||
use hyperfine::types::BenchmarkResult;
|
||||
use hyperfine::units::Unit;
|
||||
|
||||
use std::io::{Error, ErrorKind, Result};
|
||||
|
||||
@@ -10,10 +11,10 @@ use csv::WriterBuilder;
|
||||
pub struct CsvExporter {}
|
||||
|
||||
impl Exporter for CsvExporter {
|
||||
fn serialize(&self, results: &Vec<BenchmarkResult>) -> Result<Vec<u8>> {
|
||||
fn serialize(&self, results: &Vec<BenchmarkResult>, _unit: Option<Unit>) -> Result<Vec<u8>> {
|
||||
let mut writer = WriterBuilder::new().from_writer(vec![]);
|
||||
for res in results {
|
||||
// The list of times can not be exported to the CSV file - remove it:
|
||||
// The list of times cannot be exported to the CSV file - remove it:
|
||||
let mut result = res.clone();
|
||||
result.times = None;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use super::Exporter;
|
||||
use hyperfine::types::BenchmarkResult;
|
||||
use hyperfine::units::Unit;
|
||||
|
||||
use std::io::{Error, ErrorKind, Result};
|
||||
|
||||
@@ -14,7 +15,7 @@ struct HyperfineSummary<'a> {
|
||||
pub struct JsonExporter {}
|
||||
|
||||
impl Exporter for JsonExporter {
|
||||
fn serialize(&self, results: &Vec<BenchmarkResult>) -> Result<Vec<u8>> {
|
||||
fn serialize(&self, results: &Vec<BenchmarkResult>, _unit: Option<Unit>) -> Result<Vec<u8>> {
|
||||
let mut output = to_vec_pretty(&HyperfineSummary { results });
|
||||
for content in output.iter_mut() {
|
||||
content.push(b'\n');
|
||||
|
||||
@@ -1,40 +1,248 @@
|
||||
use super::Exporter;
|
||||
|
||||
use hyperfine::format::format_duration_value;
|
||||
use hyperfine::types::BenchmarkResult;
|
||||
use hyperfine::units::Unit;
|
||||
|
||||
use std::io::Result;
|
||||
|
||||
const MULTIPLIER: f64 = 1e3;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct MarkdownExporter {}
|
||||
|
||||
impl Exporter for MarkdownExporter {
|
||||
fn serialize(&self, results: &Vec<BenchmarkResult>) -> Result<Vec<u8>> {
|
||||
let mut destination = start_table();
|
||||
fn serialize(&self, results: &Vec<BenchmarkResult>, unit: Option<Unit>) -> Result<Vec<u8>> {
|
||||
let unit = if let Some(unit) = unit {
|
||||
// Use the given unit for all entries.
|
||||
unit
|
||||
} else if let Some(first_result) = results.first() {
|
||||
// Use the first BenchmarkResult entry to determine the unit for all entries.
|
||||
format_duration_value(first_result.mean, None).1
|
||||
} else {
|
||||
// Default to `Second`.
|
||||
Unit::Second
|
||||
};
|
||||
|
||||
let mut destination = start_table(unit);
|
||||
|
||||
for result in results {
|
||||
add_table_row(&mut destination, result);
|
||||
add_table_row(&mut destination, result, unit);
|
||||
}
|
||||
|
||||
Ok(destination)
|
||||
}
|
||||
}
|
||||
|
||||
fn start_table() -> Vec<u8> {
|
||||
"| Command | Mean [ms] | Min…Max [ms] |\n|:---|---:|---:|\n"
|
||||
.bytes()
|
||||
.collect()
|
||||
fn table_header(unit_short_name: String) -> String {
|
||||
format!(
|
||||
"| Command | Mean [{unit}] | Min…Max [{unit}] |\n|:---|---:|---:|\n",
|
||||
unit = unit_short_name
|
||||
)
|
||||
}
|
||||
fn add_table_row(dest: &mut Vec<u8>, entry: &BenchmarkResult) {
|
||||
|
||||
fn start_table(unit: Unit) -> Vec<u8> {
|
||||
table_header(unit.short_name()).bytes().collect()
|
||||
}
|
||||
|
||||
fn add_table_row(dest: &mut Vec<u8>, entry: &BenchmarkResult, unit: Unit) {
|
||||
let mean_str = format_duration_value(entry.mean, Some(unit)).0;
|
||||
let stddev_str = format_duration_value(entry.stddev, Some(unit)).0;
|
||||
let min_str = format_duration_value(entry.min, Some(unit)).0;
|
||||
let max_str = format_duration_value(entry.max, Some(unit)).0;
|
||||
|
||||
dest.extend(
|
||||
format!(
|
||||
"| `{}` | {:.1} ± {:.1} | {:.1}…{:.1} |\n",
|
||||
entry.command.replace("|", "\\|"),
|
||||
entry.mean * MULTIPLIER,
|
||||
entry.stddev * MULTIPLIER,
|
||||
entry.min * MULTIPLIER,
|
||||
entry.max * MULTIPLIER
|
||||
"| `{command}` | {mean} ± {stddev} | {min}…{max} |\n",
|
||||
command = entry.command.replace("|", "\\|"),
|
||||
mean = mean_str,
|
||||
stddev = stddev_str,
|
||||
min = min_str,
|
||||
max = max_str,
|
||||
)
|
||||
.as_bytes(),
|
||||
);
|
||||
}
|
||||
|
||||
/// Ensure the markdown output includes the table header and the multiple
|
||||
/// benchmark results as a table. The list of actual times is not included
|
||||
/// in the output.
|
||||
///
|
||||
/// This also demonstrates that the first entry's units (ms) are used to set
|
||||
/// the units for all entries when the time unit is not given.
|
||||
#[test]
|
||||
fn test_markdown_format_ms() {
|
||||
let exporter = MarkdownExporter::default();
|
||||
|
||||
let mut timing_results = vec![];
|
||||
|
||||
timing_results.push(BenchmarkResult::new(
|
||||
String::from("sleep 0.1"),
|
||||
0.1057, // mean
|
||||
0.0016, // std dev
|
||||
0.0009, // user_mean
|
||||
0.0011, // system_mean
|
||||
0.1023, // min
|
||||
0.1080, // max
|
||||
vec![0.1, 0.1, 0.1], // times
|
||||
));
|
||||
|
||||
timing_results.push(BenchmarkResult::new(
|
||||
String::from("sleep 2"),
|
||||
2.0050, // mean
|
||||
0.0020, // std dev
|
||||
0.0009, // user_mean
|
||||
0.0012, // system_mean
|
||||
2.0020, // min
|
||||
2.0080, // max
|
||||
vec![2.0, 2.0, 2.0], // times
|
||||
));
|
||||
|
||||
let formatted = String::from_utf8(exporter.serialize(&timing_results, None).unwrap()).unwrap();
|
||||
|
||||
let formatted_expected = format!(
|
||||
"{}\
|
||||
| `sleep 0.1` | 105.7 ± 1.6 | 102.3…108.0 |
|
||||
| `sleep 2` | 2005.0 ± 2.0 | 2002.0…2008.0 |
|
||||
",
|
||||
table_header("ms".to_string())
|
||||
);
|
||||
|
||||
assert_eq!(formatted_expected, formatted);
|
||||
}
|
||||
|
||||
/// This (again) demonstrates that the first entry's units (s) are used to set
|
||||
/// the units for all entries when the time unit is not given.
|
||||
#[test]
|
||||
fn test_markdown_format_s() {
|
||||
let exporter = MarkdownExporter::default();
|
||||
|
||||
let mut timing_results = vec![];
|
||||
|
||||
timing_results.push(BenchmarkResult::new(
|
||||
String::from("sleep 2"),
|
||||
2.0050, // mean
|
||||
0.0020, // std dev
|
||||
0.0009, // user_mean
|
||||
0.0012, // system_mean
|
||||
2.0020, // min
|
||||
2.0080, // max
|
||||
vec![2.0, 2.0, 2.0], // times
|
||||
));
|
||||
|
||||
timing_results.push(BenchmarkResult::new(
|
||||
String::from("sleep 0.1"),
|
||||
0.1057, // mean
|
||||
0.0016, // std dev
|
||||
0.0009, // user_mean
|
||||
0.0011, // system_mean
|
||||
0.1023, // min
|
||||
0.1080, // max
|
||||
vec![0.1, 0.1, 0.1], // times
|
||||
));
|
||||
|
||||
let formatted = String::from_utf8(exporter.serialize(&timing_results, None).unwrap()).unwrap();
|
||||
|
||||
let formatted_expected = format!(
|
||||
"{}\
|
||||
| `sleep 2` | 2.005 ± 0.002 | 2.002…2.008 |
|
||||
| `sleep 0.1` | 0.106 ± 0.002 | 0.102…0.108 |
|
||||
",
|
||||
table_header("s".to_string())
|
||||
);
|
||||
|
||||
assert_eq!(formatted_expected, formatted);
|
||||
}
|
||||
|
||||
/// The given time unit (s) is used to set the units for all entries.
|
||||
#[test]
|
||||
fn test_markdown_format_time_unit_s() {
|
||||
let exporter = MarkdownExporter::default();
|
||||
|
||||
let mut timing_results = vec![];
|
||||
|
||||
timing_results.push(BenchmarkResult::new(
|
||||
String::from("sleep 0.1"),
|
||||
0.1057, // mean
|
||||
0.0016, // std dev
|
||||
0.0009, // user_mean
|
||||
0.0011, // system_mean
|
||||
0.1023, // min
|
||||
0.1080, // max
|
||||
vec![0.1, 0.1, 0.1], // times
|
||||
));
|
||||
|
||||
timing_results.push(BenchmarkResult::new(
|
||||
String::from("sleep 2"),
|
||||
2.0050, // mean
|
||||
0.0020, // std dev
|
||||
0.0009, // user_mean
|
||||
0.0012, // system_mean
|
||||
2.0020, // min
|
||||
2.0080, // max
|
||||
vec![2.0, 2.0, 2.0], // times
|
||||
));
|
||||
|
||||
let formatted = String::from_utf8(
|
||||
exporter
|
||||
.serialize(&timing_results, Some(Unit::Second))
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let formatted_expected = format!(
|
||||
"{}\
|
||||
| `sleep 0.1` | 0.106 ± 0.002 | 0.102…0.108 |
|
||||
| `sleep 2` | 2.005 ± 0.002 | 2.002…2.008 |
|
||||
",
|
||||
table_header("s".to_string())
|
||||
);
|
||||
|
||||
assert_eq!(formatted_expected, formatted);
|
||||
}
|
||||
|
||||
/// This (again) demonstrates that the given time unit (ms) is used to set
|
||||
/// the units for all entries.
|
||||
#[test]
|
||||
fn test_markdown_format_time_unit_ms() {
|
||||
let exporter = MarkdownExporter::default();
|
||||
|
||||
let mut timing_results = vec![];
|
||||
|
||||
timing_results.push(BenchmarkResult::new(
|
||||
String::from("sleep 2"),
|
||||
2.0050, // mean
|
||||
0.0020, // std dev
|
||||
0.0009, // user_mean
|
||||
0.0012, // system_mean
|
||||
2.0020, // min
|
||||
2.0080, // max
|
||||
vec![2.0, 2.0, 2.0], // times
|
||||
));
|
||||
|
||||
timing_results.push(BenchmarkResult::new(
|
||||
String::from("sleep 0.1"),
|
||||
0.1057, // mean
|
||||
0.0016, // std dev
|
||||
0.0009, // user_mean
|
||||
0.0011, // system_mean
|
||||
0.1023, // min
|
||||
0.1080, // max
|
||||
vec![0.1, 0.1, 0.1], // times
|
||||
));
|
||||
|
||||
let formatted = String::from_utf8(
|
||||
exporter
|
||||
.serialize(&timing_results, Some(Unit::MilliSecond))
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let formatted_expected = format!(
|
||||
"{}\
|
||||
| `sleep 2` | 2005.0 ± 2.0 | 2002.0…2008.0 |
|
||||
| `sleep 0.1` | 105.7 ± 1.6 | 102.3…108.0 |
|
||||
",
|
||||
table_header("ms".to_string())
|
||||
);
|
||||
|
||||
assert_eq!(formatted_expected, formatted);
|
||||
}
|
||||
@@ -10,6 +10,7 @@ use std::fs::File;
|
||||
use std::io::{Result, Write};
|
||||
|
||||
use hyperfine::types::BenchmarkResult;
|
||||
use hyperfine::units::Unit;
|
||||
|
||||
/// The desired form of exporter to use for a given file.
|
||||
#[derive(Clone)]
|
||||
@@ -27,7 +28,7 @@ pub enum ExportType {
|
||||
/// Interface for different exporters.
|
||||
trait Exporter {
|
||||
/// Export the given entries in the serialized form.
|
||||
fn serialize(&self, results: &Vec<BenchmarkResult>) -> Result<Vec<u8>>;
|
||||
fn serialize(&self, results: &Vec<BenchmarkResult>, unit: Option<Unit>) -> Result<Vec<u8>>;
|
||||
}
|
||||
|
||||
struct ExporterWithFilename {
|
||||
@@ -62,9 +63,9 @@ impl ExportManager {
|
||||
}
|
||||
|
||||
/// Write the given results to all Exporters contained within this manager
|
||||
pub fn write_results(&self, results: Vec<BenchmarkResult>) -> Result<()> {
|
||||
pub fn write_results(&self, results: Vec<BenchmarkResult>, unit: Option<Unit>) -> Result<()> {
|
||||
for e in &self.exporters {
|
||||
let file_content = e.exporter.serialize(&results)?;
|
||||
let file_content = e.exporter.serialize(&results, unit)?;
|
||||
write_to_file(&e.filename, &file_content)?;
|
||||
}
|
||||
Ok(())
|
||||
|
||||
+10
-9
@@ -1,10 +1,4 @@
|
||||
use hyperfine::types::Second;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum Unit {
|
||||
Second,
|
||||
MilliSecond,
|
||||
}
|
||||
use hyperfine::units::{Second, Unit};
|
||||
|
||||
/// Format the given duration as a string. The output-unit can be enforced by setting `unit` to
|
||||
/// `Some(target_unit)`. If `unit` is `None`, it will be determined automatically.
|
||||
@@ -16,10 +10,17 @@ pub fn format_duration(duration: Second, unit: Option<Unit>) -> String {
|
||||
|
||||
/// Like `format_duration`, but returns the target unit as well.
|
||||
pub fn format_duration_unit(duration: Second, unit: Option<Unit>) -> (String, Unit) {
|
||||
let (out_str, out_unit) = format_duration_value(duration, unit);
|
||||
|
||||
(format!("{} {}", out_str, out_unit.short_name()), out_unit)
|
||||
}
|
||||
|
||||
/// Like `format_duration`, but returns the target unit as well.
|
||||
pub fn format_duration_value(duration: Second, unit: Option<Unit>) -> (String, Unit) {
|
||||
if (duration < 1.0 && unit.is_none()) || unit == Some(Unit::MilliSecond) {
|
||||
(format!("{:.1} ms", duration * 1e3), Unit::MilliSecond)
|
||||
(Unit::MilliSecond.format(duration), Unit::MilliSecond)
|
||||
} else {
|
||||
(format!("{:.3} s", duration), Unit::Second)
|
||||
(Unit::Second.format(duration), Unit::Second)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use colored::*;
|
||||
use indicatif::{ProgressBar, ProgressStyle};
|
||||
|
||||
use hyperfine::types::{BenchmarkResult, OutputStyleOption, Second};
|
||||
use hyperfine::types::{BenchmarkResult, OutputStyleOption};
|
||||
use hyperfine::units::Second;
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::iter::Iterator;
|
||||
|
||||
@@ -8,4 +8,5 @@ pub mod outlier_detection;
|
||||
pub mod shell;
|
||||
pub mod timer;
|
||||
pub mod types;
|
||||
pub mod units;
|
||||
pub mod warnings;
|
||||
+20
-8
@@ -19,8 +19,13 @@ pub struct ExecuteResult {
|
||||
|
||||
/// Execute the given command and return a timing summary
|
||||
#[cfg(windows)]
|
||||
pub fn execute_and_time(stdout: Stdio, stderr: Stdio, command: &str) -> io::Result<ExecuteResult> {
|
||||
let mut child = run_shell_command(stdout, stderr, command)?;
|
||||
pub fn execute_and_time(
|
||||
stdout: Stdio,
|
||||
stderr: Stdio,
|
||||
command: &str,
|
||||
shell: &str,
|
||||
) -> io::Result<ExecuteResult> {
|
||||
let mut child = run_shell_command(stdout, stderr, command, shell)?;
|
||||
let cpu_timer = get_cpu_timer(&child);
|
||||
let status = child.wait()?;
|
||||
|
||||
@@ -34,10 +39,15 @@ pub fn execute_and_time(stdout: Stdio, stderr: Stdio, command: &str) -> io::Resu
|
||||
|
||||
/// Execute the given command and return a timing summary
|
||||
#[cfg(not(windows))]
|
||||
pub fn execute_and_time(stdout: Stdio, stderr: Stdio, command: &str) -> io::Result<ExecuteResult> {
|
||||
pub fn execute_and_time(
|
||||
stdout: Stdio,
|
||||
stderr: Stdio,
|
||||
command: &str,
|
||||
shell: &str,
|
||||
) -> io::Result<ExecuteResult> {
|
||||
let cpu_timer = get_cpu_timer();
|
||||
|
||||
let status = run_shell_command(stdout, stderr, command)?;
|
||||
let status = run_shell_command(stdout, stderr, command, shell)?;
|
||||
|
||||
let (user_time, system_time) = cpu_timer.stop();
|
||||
|
||||
@@ -48,14 +58,15 @@ pub fn execute_and_time(stdout: Stdio, stderr: Stdio, command: &str) -> io::Resu
|
||||
})
|
||||
}
|
||||
|
||||
/// Run a standard shell command
|
||||
/// Run a standard shell command using `sh -c`
|
||||
#[cfg(not(windows))]
|
||||
fn run_shell_command(
|
||||
stdout: Stdio,
|
||||
stderr: Stdio,
|
||||
command: &str,
|
||||
shell: &str,
|
||||
) -> io::Result<std::process::ExitStatus> {
|
||||
Command::new("sh")
|
||||
Command::new(shell)
|
||||
.arg("-c")
|
||||
.arg(command)
|
||||
.stdin(Stdio::null())
|
||||
@@ -64,14 +75,15 @@ fn run_shell_command(
|
||||
.status()
|
||||
}
|
||||
|
||||
/// Run a Windows shell command using cmd.exe
|
||||
/// Run a Windows shell command using `cmd.exe /C`
|
||||
#[cfg(windows)]
|
||||
fn run_shell_command(
|
||||
stdout: Stdio,
|
||||
stderr: Stdio,
|
||||
command: &str,
|
||||
shell: &str,
|
||||
) -> io::Result<std::process::Child> {
|
||||
Command::new("cmd.exe")
|
||||
Command::new(shell)
|
||||
.arg("/C")
|
||||
.arg(command)
|
||||
.stdin(Stdio::null())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use hyperfine::types::Second;
|
||||
use hyperfine::units::Second;
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct CPUTimes {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use super::internal::{CPUInterval, CPUTimes};
|
||||
use hyperfine::timer::{TimerStart, TimerStop};
|
||||
use hyperfine::types::Second;
|
||||
use hyperfine::units::Second;
|
||||
|
||||
use std::mem;
|
||||
use std::process::Child;
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::process::Child;
|
||||
use std::time::Instant;
|
||||
|
||||
use hyperfine::timer::{TimerStart, TimerStop};
|
||||
use hyperfine::types::Second;
|
||||
use hyperfine::units::Second;
|
||||
|
||||
pub struct WallClockTimer {
|
||||
start: Instant,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#![cfg(windows)]
|
||||
|
||||
use super::internal::CPUTimes;
|
||||
use hyperfine::types::Second;
|
||||
use hyperfine::timer::{TimerStart, TimerStop};
|
||||
use hyperfine::units::Second;
|
||||
|
||||
use winapi::um::processthreadsapi::GetProcessTimes;
|
||||
use winapi::um::winnt::HANDLE;
|
||||
|
||||
+15
-2
@@ -1,8 +1,13 @@
|
||||
/// This module contains common internal types.
|
||||
use std::fmt;
|
||||
|
||||
/// Type alias for unit of time
|
||||
pub type Second = f64;
|
||||
use hyperfine::units::{Second, Unit};
|
||||
|
||||
#[cfg(not(windows))]
|
||||
pub const DEFAULT_SHELL: &str = "sh";
|
||||
|
||||
#[cfg(windows)]
|
||||
pub const DEFAULT_SHELL: &str = "cmd.exe";
|
||||
|
||||
/// A command that should be benchmarked.
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -111,8 +116,14 @@ pub struct HyperfineOptions {
|
||||
/// What color mode to use for output
|
||||
pub output_style: OutputStyleOption,
|
||||
|
||||
/// The shell to use for executing commands.
|
||||
pub shell: String,
|
||||
|
||||
/// Forward benchmark's stdout to hyperfine's stdout
|
||||
pub show_output: bool,
|
||||
|
||||
/// Which time unit to use for CLI & Markdown output
|
||||
pub time_unit: Option<Unit>,
|
||||
}
|
||||
|
||||
impl Default for HyperfineOptions {
|
||||
@@ -124,7 +135,9 @@ impl Default for HyperfineOptions {
|
||||
failure_action: CmdFailureAction::RaiseError,
|
||||
preparation_command: None,
|
||||
output_style: OutputStyleOption::Full,
|
||||
shell: DEFAULT_SHELL.to_string(),
|
||||
show_output: false,
|
||||
time_unit: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/// This module contains common units.
|
||||
|
||||
/// Type alias for unit of time
|
||||
pub type Second = f64;
|
||||
|
||||
/// Supported time units
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum Unit {
|
||||
Second,
|
||||
MilliSecond,
|
||||
}
|
||||
|
||||
impl Unit {
|
||||
/// The abbreviation of the Unit.
|
||||
pub fn short_name(&self) -> String {
|
||||
match *self {
|
||||
Unit::Second => String::from("s"),
|
||||
Unit::MilliSecond => String::from("ms"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the Second value formatted for the Unit.
|
||||
pub fn format(&self, value: Second) -> String {
|
||||
match *self {
|
||||
Unit::Second => format!("{:.3}", value),
|
||||
Unit::MilliSecond => format!("{:.1}", value * 1e3),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unit_short_name() {
|
||||
assert_eq!("s", Unit::Second.short_name());
|
||||
assert_eq!("ms", Unit::MilliSecond.short_name());
|
||||
}
|
||||
|
||||
// Note - the values are rounded when formatted.
|
||||
#[test]
|
||||
fn test_unit_format() {
|
||||
let value: Second = 123.456789;
|
||||
assert_eq!("123.457", Unit::Second.format(value));
|
||||
assert_eq!("123456.8", Unit::MilliSecond.format(value));
|
||||
}
|
||||
@@ -2,7 +2,7 @@ use std::fmt;
|
||||
|
||||
use hyperfine::format::format_duration;
|
||||
use hyperfine::internal::MIN_EXECUTION_TIME;
|
||||
use hyperfine::types::Second;
|
||||
use hyperfine::units::Second;
|
||||
|
||||
/// A list of all possible warnings
|
||||
pub enum Warnings {
|
||||
|
||||
+19
-6
@@ -48,6 +48,7 @@ use hyperfine::internal::write_benchmark_comparison;
|
||||
use hyperfine::types::{
|
||||
BenchmarkResult, CmdFailureAction, Command, HyperfineOptions, OutputStyleOption,
|
||||
};
|
||||
use hyperfine::units::Unit;
|
||||
|
||||
/// Print error message to stderr and terminate
|
||||
pub fn error(message: &str) -> ! {
|
||||
@@ -57,7 +58,8 @@ pub fn error(message: &str) -> ! {
|
||||
|
||||
/// Runs the benchmark for the given commands
|
||||
fn run(commands: &Vec<Command>, options: &HyperfineOptions) -> io::Result<Vec<BenchmarkResult>> {
|
||||
let shell_spawning_time = mean_shell_spawning_time(&options.output_style, options.show_output)?;
|
||||
let shell_spawning_time =
|
||||
mean_shell_spawning_time(&options.shell, &options.output_style, options.show_output)?;
|
||||
|
||||
let mut timing_results = vec![];
|
||||
|
||||
@@ -96,14 +98,14 @@ fn main() {
|
||||
let commands = build_commands(&matches);
|
||||
|
||||
let res = match options {
|
||||
Ok(opts) => run(&commands, &opts),
|
||||
Err(e) => error(e.description()),
|
||||
Ok(ref opts) => run(&commands, &opts),
|
||||
Err(ref e) => error(e.description()),
|
||||
};
|
||||
|
||||
match res {
|
||||
Ok(timing_results) => {
|
||||
write_benchmark_comparison(&timing_results);
|
||||
let ans = export_manager.write_results(timing_results);
|
||||
let ans = export_manager.write_results(timing_results, options.unwrap().time_unit);
|
||||
if let Err(e) = ans {
|
||||
error(&format!(
|
||||
"The following error occurred while exporting: {}",
|
||||
@@ -123,7 +125,7 @@ fn build_hyperfine_options(matches: &ArgMatches) -> Result<HyperfineOptions, Opt
|
||||
options.warmup_count = matches
|
||||
.value_of("warmup")
|
||||
.and_then(&str_to_u64)
|
||||
.unwrap_or(0);
|
||||
.unwrap_or(options.warmup_count);
|
||||
|
||||
let mut min_runs = matches.value_of("min-runs").and_then(&str_to_u64);
|
||||
let mut max_runs = matches.value_of("max-runs").and_then(&str_to_u64);
|
||||
@@ -188,12 +190,23 @@ fn build_hyperfine_options(matches: &ArgMatches) -> Result<HyperfineOptions, Opt
|
||||
colored::control::set_override(false)
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
};
|
||||
|
||||
options.shell = matches
|
||||
.value_of("shell")
|
||||
.unwrap_or(&options.shell)
|
||||
.to_string();
|
||||
|
||||
if matches.is_present("ignore-failure") {
|
||||
options.failure_action = CmdFailureAction::Ignore;
|
||||
}
|
||||
|
||||
options.time_unit = match matches.value_of("time-unit") {
|
||||
Some("millisecond") => Some(Unit::MilliSecond),
|
||||
Some("second") => Some(Unit::Second),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
Ok(options)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user