mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-29 03:10:51 +00:00
Compare commits
36
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39b2910415 | ||
|
|
8bd60a4e3e | ||
|
|
db45181c88 | ||
|
|
cb59053564 | ||
|
|
cf2c051812 | ||
|
|
393122dcde | ||
|
|
49fcc4be37 | ||
|
|
b04a9ec6c4 | ||
|
|
1f7284dae3 | ||
|
|
d18bdd98d7 | ||
|
|
89700a244c | ||
|
|
5f949b17ad | ||
|
|
77fcb6a6b3 | ||
|
|
80b6bdb90b | ||
|
|
0ab24d49b3 | ||
|
|
cf0ce696a7 | ||
|
|
2e4bce63d3 | ||
|
|
53bc46f6b6 | ||
|
|
a4d9c5eff7 | ||
|
|
907d38aa18 | ||
|
|
3553812436 | ||
|
|
591cce786a | ||
|
|
1d5626207a | ||
|
|
8704e76d36 | ||
|
|
e1fea57182 | ||
|
|
c05d7f9480 | ||
|
|
990ed45c3a | ||
|
|
2547342644 | ||
|
|
d7e6fa6dfb | ||
|
|
4fa16852cf | ||
|
|
e947a62ce2 | ||
|
|
118baa90c9 | ||
|
|
46ad9bf39a | ||
|
|
f67763fd34 | ||
|
|
699d8ca329 | ||
|
|
b2a246c195 |
No files matched your search
@@ -0,0 +1,8 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: cargo
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: monthly
|
||||
time: "04:00"
|
||||
timezone: Europe/Berlin
|
||||
+17
-12
@@ -1,6 +1,5 @@
|
||||
language: rust
|
||||
cache: cargo
|
||||
matrix:
|
||||
jobs:
|
||||
include:
|
||||
# Stable channel.
|
||||
- os: linux
|
||||
@@ -18,6 +17,17 @@ matrix:
|
||||
- os: osx
|
||||
rust: stable
|
||||
env: TARGET=x86_64-apple-darwin
|
||||
- os: linux
|
||||
rust: stable
|
||||
env:
|
||||
- TARGET=arm-unknown-linux-gnueabihf
|
||||
- CC_arm_unknown_linux_gnueabihf=/usr/bin/arm-linux-gnueabihf-gcc-4.8
|
||||
- CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc-4.8
|
||||
- os: linux
|
||||
rust: stable
|
||||
env:
|
||||
- TARGET=arm-unknown-linux-musleabihf
|
||||
- CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_LINKER=arm-linux-gnueabihf-gcc-4.8
|
||||
|
||||
# Minimum Rust supported channel.
|
||||
- os: linux
|
||||
@@ -36,13 +46,8 @@ matrix:
|
||||
rust: 1.43.0
|
||||
env: TARGET=x86_64-apple-darwin
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
# needed for i686-unknown-linux-gnu target
|
||||
- gcc-multilib
|
||||
# needed to build deb packages
|
||||
- fakeroot
|
||||
before_install:
|
||||
- ci/before_install.bash
|
||||
|
||||
env:
|
||||
global:
|
||||
@@ -59,19 +64,19 @@ install:
|
||||
script:
|
||||
# Incorporate TARGET env var to the build and test process
|
||||
- cargo build --target $TARGET --verbose
|
||||
- cargo test --target $TARGET --verbose
|
||||
- '[[ $TARGET == arm-unknown-linux-* ]] || cargo test --target $TARGET --verbose'
|
||||
|
||||
before_deploy:
|
||||
- bash ci/before_deploy.bash
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
# NOTE updating the `api_key.secure`
|
||||
# NOTE updating the `token.secure`
|
||||
# - go to: https://github.com/settings/tokens/new
|
||||
# - generate new token using `public_repo` scope
|
||||
# - encrypt it using: `travis encrypt API_KEY_HERE`
|
||||
# - paste the output below
|
||||
api_key:
|
||||
token:
|
||||
secure: "U9QfCOQkeozaDNrTV6i2vRocX2puB5p1WSN+w9t/1j33rAtXx6ZhFx67A8nl0+dQ9nvPu/RIsFWXrYzfHQskL1WulKNHm0S5otN+747dEzbSIfMNi1UfysyCiM1SNPq+FX3qOkva83+Fe2Lyd1g4gQObceE4xsgfplfzdm+ebIa6CrfKOypToEuetzP/r8V0WpW4Cp8ojQwvsL1nfHjr1gmvmr443Gr9Yvgq9SS/NAHldrpaJr8mD26W/7jbHdm3lvrNwqLbthYDUTPZsO+2B44h+T/tuhVYbur4fel1KMo4mkIwZwsSKvJbf3Q6Vdcc9dZM+niZU78UGLt0JNEMQNqQLPGYqh+TlFR2B++lcYlybT3LcUaSkt0YIX7C4DAbMLS6sl5Fq2pRNuM/eY2BWdHf0I+K19PDxUEliUifsfSQ3rbfl52aKKLcJa0WPyDJt0qldElagxOaTIk/jn1kKkdkQu9M4gVzKXImIauRQih3CLER7th8ADMxW5Plgq8fvffJBTKlubUznKrGeeR3Mjm8DsRjhkIvFO0Doqmki4sd5zE/BOFI5a/SHg73ms+bLXLuKFK+YzIlHszCHolzkAT44aq7+LEudk8jt+QVtBEocCN/4ew4Q9Qh2tcn22+hU3Aw88lO95PsbZzTzoFtX4X89Sl1fGtpkHFZvvL4ZT0="
|
||||
# for uploading multiple files
|
||||
file_glob: true
|
||||
|
||||
+32
-6
@@ -1,8 +1,30 @@
|
||||
# unreleased
|
||||
|
||||
- Add command exit code to output if it fails, see #342 (@KaindlJulian)
|
||||
|
||||
## Features
|
||||
|
||||
- The `-L`/`--parameter-list` option can now be specified multiple times to evaluate all possible combinations of the listed parameters:
|
||||
## Changes
|
||||
|
||||
- When `--export-*` commands are used, result files are created before benchmark execution
|
||||
to fail early in case of, e.g., wrong permissions. See #306 (@s1ck).
|
||||
- When `--export-*` options are used, result files are written after each individual
|
||||
benchmark command instead of writing after all benchmarks have finished. See #306 (@s1ck).
|
||||
|
||||
## Bugfixes
|
||||
|
||||
## Other
|
||||
|
||||
## Packaging
|
||||
|
||||
|
||||
|
||||
# v1.11.0
|
||||
|
||||
## Features
|
||||
|
||||
- The `-L`/`--parameter-list` option can now be specified multiple times to
|
||||
evaluate all possible combinations of the listed parameters:
|
||||
|
||||
``` bash
|
||||
hyperfine -L number 1,2 -L letter a,b,c \
|
||||
@@ -18,16 +40,20 @@
|
||||
|
||||
## Changes
|
||||
|
||||
- When parameters are used with `--parameter-list` or `--parameter-scan`, the JSON export format now contains a dictionary `parameters` instead of a single key `parameter`. See #253, #318.
|
||||
- The `plot_parametrized.py` script now infers the parameter name, and its `--parameter-name` argument has been deprecated. See #253, #318.
|
||||
- When parameters are used with `--parameter-list` or `--parameter-scan`, the JSON export format
|
||||
now contains a dictionary `parameters` instead of a single key `parameter`. See #253, #318.
|
||||
- The `plot_parametrized.py` script now infers the parameter name, and its `--parameter-name`
|
||||
argument has been deprecated. See #253, #318.
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Fix a bug in the outlier detection which would only detect "slow outliers" but not the fast ones (runs that are much faster than the rest of the benchmarking runs), see #329
|
||||
- Fix a bug in the outlier detection which would only detect "slow outliers" but not the fast
|
||||
ones (runs that are much faster than the rest of the benchmarking runs), see #329
|
||||
- Better error messages for very fast commands that would lead to inf/nan results in the relative
|
||||
speed comparison, see #319
|
||||
- Show error message if `--warmup` or `--*runs` arguments can not be parsed, see #337
|
||||
- Keep output colorized when the output is not interactive and `--style=full` or `--style=color` is used.
|
||||
|
||||
## Other
|
||||
## Packaging
|
||||
|
||||
# v1.10.0
|
||||
|
||||
|
||||
Generated
+88
-76
@@ -11,13 +11,19 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "approx"
|
||||
version = "0.3.2"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3"
|
||||
checksum = "3f2a05fd1bd10b2527e20a2cd32d8873d115b8b39fe219ee25f42a8aca6ba278"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
@@ -37,9 +43,9 @@ checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
|
||||
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
@@ -71,6 +77,12 @@ version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.33.3"
|
||||
@@ -109,9 +121,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "console"
|
||||
version = "0.11.3"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c0994e656bba7b922d8dd1245db90672ffb701e684e45be58f20719d69abc5a"
|
||||
checksum = "c0b1aacfaffdbff75be81c15a399b4bedf78aaefe840e8af1d299ac2ade885d2"
|
||||
dependencies = [
|
||||
"encode_unicode",
|
||||
"lazy_static",
|
||||
@@ -126,9 +138,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "csv"
|
||||
version = "1.1.3"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279"
|
||||
checksum = "f9d58633299b24b515ac72a3f869f8b91306a3cec616a602843a383acd6f9e97"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"csv-core",
|
||||
@@ -160,37 +172,37 @@ checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.1.14"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
|
||||
checksum = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 0.1.10",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.13"
|
||||
version = "0.1.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71"
|
||||
checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyperfine"
|
||||
version = "1.10.0"
|
||||
version = "1.11.0"
|
||||
dependencies = [
|
||||
"approx",
|
||||
"atty",
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"clap",
|
||||
"colored",
|
||||
"csv",
|
||||
"indicatif",
|
||||
"libc",
|
||||
"rand 0.7.3",
|
||||
"rand 0.8.3",
|
||||
"rust_decimal",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -213,9 +225,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.5"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e"
|
||||
checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
@@ -225,9 +237,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.77"
|
||||
version = "0.2.86"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
|
||||
checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
@@ -255,7 +267,7 @@ version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304"
|
||||
dependencies = [
|
||||
"autocfg 1.0.0",
|
||||
"autocfg 1.0.1",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
@@ -266,27 +278,27 @@ version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95"
|
||||
dependencies = [
|
||||
"autocfg 1.0.0",
|
||||
"autocfg 1.0.1",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.42"
|
||||
version = "0.1.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
|
||||
checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b"
|
||||
dependencies = [
|
||||
"autocfg 1.0.0",
|
||||
"autocfg 1.0.1",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-iter"
|
||||
version = "0.1.40"
|
||||
version = "0.1.41"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfb0800a0291891dd9f4fe7bd9c19384f98f7fbe0cd0f39a2c6b88b9868bbc00"
|
||||
checksum = "7a6e6b7c748f995c4c29c5f5ae0248536e04a5739927c74ec0fa564805094b9f"
|
||||
dependencies = [
|
||||
"autocfg 1.0.0",
|
||||
"autocfg 1.0.1",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
@@ -297,7 +309,7 @@ version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef"
|
||||
dependencies = [
|
||||
"autocfg 1.0.0",
|
||||
"autocfg 1.0.1",
|
||||
"num-bigint",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
@@ -305,11 +317,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.11"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
|
||||
checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611"
|
||||
dependencies = [
|
||||
"autocfg 1.0.0",
|
||||
"autocfg 1.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -320,24 +332,24 @@ checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.8"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea"
|
||||
checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.17"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1502d12e458c49a4c9cbff560d0fe0060c252bc29799ed94ca2ed4bb665a0101"
|
||||
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.6"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea"
|
||||
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -363,15 +375,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.7.3"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
||||
checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"libc",
|
||||
"rand_chacha 0.2.2",
|
||||
"rand_core 0.5.1",
|
||||
"rand_hc 0.2.0",
|
||||
"rand_chacha 0.3.0",
|
||||
"rand_core 0.6.0",
|
||||
"rand_hc 0.3.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -386,12 +397,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.2.2"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
|
||||
checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.5.1",
|
||||
"rand_core 0.6.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -411,9 +422,9 @@ checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.5.1"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||
checksum = "a8b34ba8cfb21243bd8df91854c830ff0d785fff2e82ebd4434c2644cb9ada18"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
@@ -429,11 +440,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||
checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
|
||||
dependencies = [
|
||||
"rand_core 0.5.1",
|
||||
"rand_core 0.6.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -500,9 +511,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.3.7"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692"
|
||||
checksum = "8963b85b8ce3074fecffde43b4b0dded83ce2f367dc8d363afc56679f3ee820b"
|
||||
dependencies = [
|
||||
"regex-syntax",
|
||||
]
|
||||
@@ -518,40 +529,41 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.17"
|
||||
version = "0.6.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae"
|
||||
checksum = "8cab7a364d15cde1e505267766a2d3c4e22a843e1a601f0fa7564c0f82ced11c"
|
||||
|
||||
[[package]]
|
||||
name = "rust_decimal"
|
||||
version = "1.8.1"
|
||||
version = "1.10.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9e81662973c7a8d9663e64a0de4cd642b89a21d64966e3d99606efdc5fb0cc6"
|
||||
checksum = "dc7f5b8840fb1f83869a3e1dfd06d93db79ea05311ac5b42b8337d3371caa4f1"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"num-traits",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.4"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1"
|
||||
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.116"
|
||||
version = "1.0.123"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5"
|
||||
checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.116"
|
||||
version = "1.0.123"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8"
|
||||
checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -560,9 +572,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.58"
|
||||
version = "1.0.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a230ea9107ca2220eea9d46de97eddcb04cd00e92d13dda78e478dd33fa82bd4"
|
||||
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@@ -587,9 +599,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.33"
|
||||
version = "1.0.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd"
|
||||
checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -608,9 +620,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "terminal_size"
|
||||
version = "0.1.12"
|
||||
version = "0.1.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8038f95fc7a6f351163f4b964af631bd26c9e828f7db085f2a84aca56f70d13b"
|
||||
checksum = "9a14cd9f8c72704232f0bfc8455c0e861f0ad4eb60cc9ec8a170e231414c1e13"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
@@ -618,9 +630,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "termios"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f0fcee7b24a25675de40d5bb4de6e41b0df07bc9856295e7e2b3a3600c400c2"
|
||||
checksum = "411c5bf740737c7918b8b1fe232dca4dc9f8e754b8ad5e20966814001ed0ac6b"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@@ -637,15 +649,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.7"
|
||||
version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
|
||||
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
|
||||
+6
-6
@@ -7,7 +7,7 @@ license = "MIT/Apache-2.0"
|
||||
name = "hyperfine"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/sharkdp/hyperfine"
|
||||
version = "1.10.0"
|
||||
version = "1.11.0"
|
||||
edition = "2018"
|
||||
build = "build.rs"
|
||||
|
||||
@@ -16,12 +16,12 @@ colored = "2.0"
|
||||
indicatif = "0.15"
|
||||
statistical = "1.0"
|
||||
atty = "0.2"
|
||||
cfg-if = "0.1"
|
||||
csv = "1.1.3"
|
||||
cfg-if = "1.0"
|
||||
csv = "1.1.5"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
rust_decimal = "1.8"
|
||||
rand = "0.7"
|
||||
rust_decimal = "1.10"
|
||||
rand = "0.8"
|
||||
|
||||
[target.'cfg(not(windows))'.dependencies]
|
||||
libc = "0.2"
|
||||
@@ -35,7 +35,7 @@ default-features = false
|
||||
features = ["suggestions", "color", "wrap_help"]
|
||||
|
||||
[dev-dependencies]
|
||||
approx = "0.3"
|
||||
approx = "0.4"
|
||||
|
||||
[build-dependencies]
|
||||
clap = "2"
|
||||
|
||||
@@ -77,6 +77,26 @@ hyperfine --parameter-scan delay 0.3 0.7 -D 0.2 'sleep {delay}'
|
||||
```
|
||||
This runs `sleep 0.3`, `sleep 0.5` and `sleep 0.7`.
|
||||
|
||||
### Shell functions and aliases
|
||||
|
||||
If you are using bash, you can export shell functions to directly benchmark them with hyperfine:
|
||||
|
||||
```
|
||||
$ my_function() { sleep 1; }
|
||||
$ export -f my_function
|
||||
$ hyperfine my_function
|
||||
```
|
||||
|
||||
If you are using a different shell, or if you want to benchmark shell aliases, you may try to put
|
||||
them in a separate file:
|
||||
|
||||
```bash
|
||||
echo 'my_function() { sleep 1 }' > /tmp/my_function.sh
|
||||
echo 'alias my_alias="sleep 1"' > /tmp/my_alias.sh
|
||||
hyperfine 'source /tmp/my_function.sh; eval my_function'
|
||||
hyperfine 'source /tmp/my_alias.sh; eval my_alias'
|
||||
```
|
||||
|
||||
### Export results
|
||||
|
||||
Hyperfine has multiple options for exporting benchmark results: CSV, JSON, Markdown (see `--help`
|
||||
@@ -101,8 +121,8 @@ The JSON output is useful if you want to analyze the benchmark results in more d
|
||||
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.10.0/hyperfine_1.10.0_amd64.deb
|
||||
sudo dpkg -i hyperfine_1.10.0_amd64.deb
|
||||
wget https://github.com/sharkdp/hyperfine/releases/download/v1.11.0/hyperfine_1.11.0_amd64.deb
|
||||
sudo dpkg -i hyperfine_1.11.0_amd64.deb
|
||||
```
|
||||
|
||||
### On Fedora
|
||||
@@ -191,7 +211,7 @@ Download the corresponding archive from the [Release page](https://github.com/sh
|
||||
## Alternative tools
|
||||
|
||||
Hyperfine is inspired by [bench](https://github.com/Gabriel439/bench).
|
||||
|
||||
|
||||
## Integration with other tools
|
||||
|
||||
[Chronologer](https://github.com/dandavison/chronologer) is a tool that uses `hyperfine` to
|
||||
|
||||
Vendored
+64
-6
@@ -11,17 +11,25 @@ pack() {
|
||||
local tempdir
|
||||
local out_dir
|
||||
local package_name
|
||||
local gcc_prefix
|
||||
|
||||
tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)
|
||||
out_dir=$(pwd)
|
||||
package_name="$PROJECT_NAME-$TRAVIS_TAG-$TARGET"
|
||||
|
||||
if [[ $TARGET == arm-unknown-linux-* ]]; then
|
||||
gcc_prefix="arm-linux-gnueabihf-"
|
||||
else
|
||||
gcc_prefix=""
|
||||
fi
|
||||
|
||||
# create a "staging" directory
|
||||
mkdir "$tempdir/$package_name"
|
||||
mkdir "$tempdir/$package_name/autocomplete"
|
||||
|
||||
# copying the main binary
|
||||
cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"
|
||||
strip "$tempdir/$package_name/$PROJECT_NAME"
|
||||
"${gcc_prefix}"strip "$tempdir/$package_name/$PROJECT_NAME"
|
||||
|
||||
# manpage, readme and license
|
||||
cp "doc/$PROJECT_NAME.1" "$tempdir/$package_name"
|
||||
@@ -30,7 +38,6 @@ pack() {
|
||||
cp LICENSE-APACHE "$tempdir/$package_name"
|
||||
|
||||
# various autocomplete
|
||||
mkdir "$tempdir/$package_name/autocomplete"
|
||||
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".bash "$tempdir/$package_name/autocomplete/${PROJECT_NAME}.bash-completion"
|
||||
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".fish "$tempdir/$package_name/autocomplete"
|
||||
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/_"$PROJECT_NAME" "$tempdir/$package_name/autocomplete"
|
||||
@@ -48,17 +55,29 @@ make_deb() {
|
||||
local version
|
||||
local dpkgname
|
||||
local conflictname
|
||||
local homepage
|
||||
local maintainer
|
||||
local gcc_prefix
|
||||
|
||||
homepage="https://github.com/sharkdp/$PROJECT_NAME"
|
||||
maintainer="David Peter <mail@david-peter.de>"
|
||||
|
||||
case $TARGET in
|
||||
x86_64*)
|
||||
architecture=amd64
|
||||
gcc_prefix=""
|
||||
;;
|
||||
i686*)
|
||||
architecture=i386
|
||||
gcc_prefix=""
|
||||
;;
|
||||
arm*hf)
|
||||
architecture=armhf
|
||||
gcc_prefix="arm-linux-gnueabihf-"
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: unknown target" >&2
|
||||
return 1
|
||||
echo "make_deb: skipping target '${TARGET}'" >&2
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
version=${TRAVIS_TAG#v}
|
||||
@@ -74,7 +93,7 @@ make_deb() {
|
||||
|
||||
# copy the main binary
|
||||
install -Dm755 "target/$TARGET/release/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME"
|
||||
strip "$tempdir/usr/bin/$PROJECT_NAME"
|
||||
"${gcc_prefix}"strip "$tempdir/usr/bin/$PROJECT_NAME"
|
||||
|
||||
# manpage
|
||||
install -Dm644 "doc/$PROJECT_NAME.1" "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"
|
||||
@@ -84,6 +103,44 @@ make_deb() {
|
||||
install -Dm644 README.md "$tempdir/usr/share/doc/$PROJECT_NAME/README.md"
|
||||
install -Dm644 LICENSE-MIT "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-MIT"
|
||||
install -Dm644 LICENSE-APACHE "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-APACHE"
|
||||
cat > "$tempdir/usr/share/doc/$PROJECT_NAME/copyright" <<EOF
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: $PROJECT_NAME
|
||||
Source: $homepage
|
||||
|
||||
Files: *
|
||||
Copyright: $maintainer
|
||||
License: Apache-2.0 or MIT
|
||||
|
||||
License: Apache-2.0
|
||||
On Debian systems, the complete text of the Apache-2.0 can be found in the
|
||||
file /usr/share/common-licenses/Apache-2.0.
|
||||
|
||||
License: MIT
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
.
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
EOF
|
||||
|
||||
# completions
|
||||
install -Dm644 target/$TARGET/release/build/$PROJECT_NAME-*/out/$PROJECT_NAME.bash "$tempdir/usr/share/bash-completion/completions/${PROJECT_NAME}"
|
||||
@@ -97,10 +154,11 @@ Package: $dpkgname
|
||||
Version: $version
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: David Peter <mail@david-peter.de>
|
||||
Maintainer: $maintainer
|
||||
Architecture: $architecture
|
||||
Provides: $PROJECT_NAME
|
||||
Conflicts: $conflictname
|
||||
Homepage: $homepage
|
||||
Description: A command-line benchmarking tool.
|
||||
EOF
|
||||
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
if [ "$TRAVIS_OS_NAME" != linux ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
# needed to build deb packages
|
||||
sudo apt-get install -y fakeroot
|
||||
|
||||
# needed for i686 linux gnu target
|
||||
if [[ $TARGET == i686-unknown-linux-* ]]; then
|
||||
sudo apt-get install -y gcc-multilib
|
||||
fi
|
||||
|
||||
# needed for cross-compiling for arm
|
||||
if [[ $TARGET == arm-unknown-linux-* ]]; then
|
||||
sudo apt-get install -y \
|
||||
gcc-4.8-arm-linux-gnueabihf \
|
||||
binutils-arm-linux-gnueabihf \
|
||||
libc6-armhf-cross \
|
||||
libc6-dev-armhf-cross
|
||||
fi
|
||||
@@ -10,16 +10,26 @@ import matplotlib.pyplot as plt
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("file", help="JSON file with benchmark results")
|
||||
parser.add_argument("--title", help="Plot title")
|
||||
parser.add_argument(
|
||||
"--labels", help="Comma-separated list of entries for the plot legend"
|
||||
)
|
||||
parser.add_argument("--bins", help="Number of bins (default: auto)")
|
||||
parser.add_argument(
|
||||
"--type", help="Type of histogram (*bar*, barstacked, step, stepfilled)"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-o", "--output", help="Save image to the given filename."
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.file) as f:
|
||||
results = json.load(f)["results"]
|
||||
|
||||
commands = [b["command"] for b in results]
|
||||
if args.labels:
|
||||
labels = args.labels.split(",")
|
||||
else:
|
||||
labels = [b["command"] for b in results]
|
||||
all_times = [b["times"] for b in results]
|
||||
|
||||
t_min = np.min(list(map(np.min, all_times)))
|
||||
@@ -29,7 +39,7 @@ bins = int(args.bins) if args.bins else "auto"
|
||||
histtype = args.type if args.type else "bar"
|
||||
|
||||
plt.hist(
|
||||
all_times, label=commands, bins=bins, histtype=histtype, range=(t_min, t_max),
|
||||
all_times, label=labels, bins=bins, histtype=histtype, range=(t_min, t_max),
|
||||
)
|
||||
plt.legend(prop={"family": ["Source Code Pro", "Fira Mono", "Courier New"]})
|
||||
|
||||
@@ -37,4 +47,7 @@ plt.xlabel("Time [s]")
|
||||
if args.title:
|
||||
plt.title(args.title)
|
||||
|
||||
plt.show()
|
||||
if args.output:
|
||||
plt.savefig(args.output)
|
||||
else:
|
||||
plt.show()
|
||||
@@ -25,6 +25,9 @@ parser.add_argument(
|
||||
parser.add_argument(
|
||||
"--titles", help="Comma-separated list of titles for the plot legend"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-o", "--output", help="Save image to the given filename."
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
if args.parameter_name is not None:
|
||||
@@ -100,4 +103,7 @@ if args.log_x:
|
||||
if args.titles:
|
||||
plt.legend(args.titles.split(","))
|
||||
|
||||
plt.show()
|
||||
if args.output:
|
||||
plt.savefig(args.output)
|
||||
else:
|
||||
plt.show()
|
||||
+10
-2
@@ -18,6 +18,10 @@ parser.add_argument("--title", help="Plot Title")
|
||||
parser.add_argument(
|
||||
"--labels", help="Comma-separated list of entries for the plot legend"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-o", "--output", help="Save image to the given filename."
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.file) as f:
|
||||
@@ -36,8 +40,12 @@ colors = [cmap(val / len(times)) for val in range(len(times))]
|
||||
for patch, color in zip(boxplot["boxes"], colors):
|
||||
patch.set_facecolor(color)
|
||||
|
||||
plt.title(args.title)
|
||||
if args.title:
|
||||
plt.title(args.title)
|
||||
plt.legend(handles=boxplot["boxes"], labels=labels, loc="best", fontsize="medium")
|
||||
plt.ylabel("Time [s]")
|
||||
plt.ylim(0, None)
|
||||
plt.show()
|
||||
if args.output:
|
||||
plt.savefig(args.output)
|
||||
else:
|
||||
plt.show()
|
||||
@@ -143,7 +143,9 @@ fn build_app() -> App<'static, 'static> {
|
||||
"Perform benchmark runs for each value in the comma-separated list VALUES. \
|
||||
Replaces the string '{VAR}' in each command by the current parameter value\
|
||||
.\n\nExample: hyperfine -L compiler gcc,clang '{compiler} -O2 main.cpp'\n\n\
|
||||
This performs benchmarks for 'gcc -O2 main.cpp' and 'clang -O2 main.cpp'.",
|
||||
This performs benchmarks for 'gcc -O2 main.cpp' and 'clang -O2 main.cpp'.\n\n\
|
||||
The option can be specified multiple times to run benchmarks for all \
|
||||
possible parameter combinations.\n"
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
|
||||
@@ -63,9 +63,15 @@ pub fn time_shell_command(
|
||||
if failure_action == CmdFailureAction::RaiseError && !result.status.success() {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
"Command terminated with non-zero exit code. \
|
||||
Use the '-i'/'--ignore-failure' option if you want to ignore this. \
|
||||
Alternatively, use the '--show-output' option to debug what went wrong.",
|
||||
format!(
|
||||
"{}. \
|
||||
Use the '-i'/'--ignore-failure' option if you want to ignore this. \
|
||||
Alternatively, use the '--show-output' option to debug what went wrong.",
|
||||
result.status.code().map_or(
|
||||
"The process has been terminated by a signal".into(),
|
||||
|c| format!("Command terminated with non-zero exit code: {}", c)
|
||||
)
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
+11
-3
@@ -2,6 +2,7 @@ use rust_decimal::Error as DecimalError;
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
use std::num;
|
||||
use std::num::ParseIntError;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ParameterScanError {
|
||||
@@ -46,13 +47,14 @@ impl fmt::Display for ParameterScanError {
|
||||
impl Error for ParameterScanError {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum OptionsError {
|
||||
pub enum OptionsError<'a> {
|
||||
RunsBelowTwo,
|
||||
EmptyRunsRange,
|
||||
TooManyCommandNames(usize),
|
||||
NumericParsingError(&'a str, ParseIntError),
|
||||
}
|
||||
|
||||
impl fmt::Display for OptionsError {
|
||||
impl<'a> fmt::Display for OptionsError<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {
|
||||
OptionsError::EmptyRunsRange => write!(f, "Empty runs range"),
|
||||
@@ -60,8 +62,14 @@ impl fmt::Display for OptionsError {
|
||||
OptionsError::TooManyCommandNames(n) => {
|
||||
write!(f, "Too many --command-name options: expected {} at most", n)
|
||||
}
|
||||
OptionsError::NumericParsingError(cmd, ref err) => write!(
|
||||
f,
|
||||
"Could not read numeric argument to '--{cmd}': {err}",
|
||||
cmd = cmd,
|
||||
err = err
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for OptionsError {}
|
||||
impl<'a> Error for OptionsError<'a> {}
|
||||
@@ -5,7 +5,7 @@ use crate::hyperfine::internal::{compute_relative_speed, BenchmarkResultWithRela
|
||||
use crate::hyperfine::types::BenchmarkResult;
|
||||
use crate::hyperfine::units::Unit;
|
||||
|
||||
use std::io::Result;
|
||||
use std::io::{Error, ErrorKind, Result};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct MarkdownExporter {}
|
||||
@@ -23,15 +23,20 @@ impl Exporter for MarkdownExporter {
|
||||
Unit::Second
|
||||
};
|
||||
|
||||
let annotated_results = compute_relative_speed(results);
|
||||
if let Some(annotated_results) = compute_relative_speed(results) {
|
||||
let mut destination = start_table(unit);
|
||||
|
||||
let mut destination = start_table(unit);
|
||||
for result in annotated_results {
|
||||
add_table_row(&mut destination, &result, unit);
|
||||
}
|
||||
|
||||
for result in annotated_results {
|
||||
add_table_row(&mut destination, &result, unit);
|
||||
Ok(destination)
|
||||
} else {
|
||||
Err(Error::new(
|
||||
ErrorKind::Other,
|
||||
"Relative speed comparison is not available for Markdown export.",
|
||||
))
|
||||
}
|
||||
|
||||
Ok(destination)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ use self::csv::CsvExporter;
|
||||
use self::json::JsonExporter;
|
||||
use self::markdown::MarkdownExporter;
|
||||
|
||||
use std::fs::File;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::{Result, Write};
|
||||
|
||||
use crate::hyperfine::types::BenchmarkResult;
|
||||
@@ -55,7 +55,9 @@ impl ExportManager {
|
||||
}
|
||||
|
||||
/// Add an additional exporter to the ExportManager
|
||||
pub fn add_exporter(&mut self, export_type: ExportType, filename: &str) {
|
||||
pub fn add_exporter(&mut self, export_type: ExportType, filename: &str) -> Result<()> {
|
||||
let _ = File::create(filename)?;
|
||||
|
||||
let exporter: Box<dyn Exporter> = match export_type {
|
||||
ExportType::Asciidoc => Box::new(AsciidocExporter::default()),
|
||||
ExportType::Csv => Box::new(CsvExporter::default()),
|
||||
@@ -66,10 +68,12 @@ impl ExportManager {
|
||||
exporter,
|
||||
filename: filename.to_string(),
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Write the given results to all Exporters contained within this manager
|
||||
pub fn write_results(&self, results: Vec<BenchmarkResult>, unit: Option<Unit>) -> Result<()> {
|
||||
pub fn write_results(&self, results: &[BenchmarkResult], unit: Option<Unit>) -> Result<()> {
|
||||
for e in &self.exporters {
|
||||
let file_content = e.exporter.serialize(&results, unit)?;
|
||||
write_to_file(&e.filename, &file_content)?;
|
||||
@@ -80,6 +84,6 @@ impl ExportManager {
|
||||
|
||||
/// Write the given content to a file with the specified name
|
||||
fn write_to_file(filename: &str, content: &[u8]) -> Result<()> {
|
||||
let mut file = File::create(filename)?;
|
||||
let mut file = OpenOptions::new().write(true).open(filename)?;
|
||||
file.write_all(content)
|
||||
}
|
||||
+66
-35
@@ -52,6 +52,7 @@ pub fn min(vals: &[f64]) -> f64 {
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct BenchmarkResultWithRelativeSpeed<'a> {
|
||||
pub result: &'a BenchmarkResult,
|
||||
pub relative_speed: Scalar,
|
||||
@@ -65,31 +66,38 @@ fn compare_mean_time(l: &BenchmarkResult, r: &BenchmarkResult) -> Ordering {
|
||||
|
||||
pub fn compute_relative_speed<'a>(
|
||||
results: &'a [BenchmarkResult],
|
||||
) -> Vec<BenchmarkResultWithRelativeSpeed<'a>> {
|
||||
) -> Option<Vec<BenchmarkResultWithRelativeSpeed<'a>>> {
|
||||
let fastest: &BenchmarkResult = results
|
||||
.iter()
|
||||
.min_by(|&l, &r| compare_mean_time(l, r))
|
||||
.expect("at least one benchmark result");
|
||||
|
||||
results
|
||||
.iter()
|
||||
.map(|result| {
|
||||
let ratio = result.mean / fastest.mean;
|
||||
if fastest.mean == 0.0 {
|
||||
return None;
|
||||
}
|
||||
|
||||
// https://en.wikipedia.org/wiki/Propagation_of_uncertainty#Example_formulas
|
||||
// Covariance asssumed to be 0, i.e. variables are assumed to be independent
|
||||
let ratio_stddev = ratio
|
||||
* ((result.stddev / result.mean).powi(2) + (fastest.stddev / fastest.mean).powi(2))
|
||||
Some(
|
||||
results
|
||||
.iter()
|
||||
.map(|result| {
|
||||
let ratio = result.mean / fastest.mean;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Propagation_of_uncertainty#Example_formulas
|
||||
// Covariance asssumed to be 0, i.e. variables are assumed to be independent
|
||||
let ratio_stddev = ratio
|
||||
* ((result.stddev / result.mean).powi(2)
|
||||
+ (fastest.stddev / fastest.mean).powi(2))
|
||||
.sqrt();
|
||||
|
||||
BenchmarkResultWithRelativeSpeed {
|
||||
result,
|
||||
relative_speed: ratio,
|
||||
relative_speed_stddev: ratio_stddev,
|
||||
is_fastest: result == fastest,
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
BenchmarkResultWithRelativeSpeed {
|
||||
result,
|
||||
relative_speed: ratio,
|
||||
relative_speed_stddev: ratio_stddev,
|
||||
is_fastest: result == fastest,
|
||||
}
|
||||
})
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn write_benchmark_comparison(results: &[BenchmarkResult]) {
|
||||
@@ -97,21 +105,31 @@ pub fn write_benchmark_comparison(results: &[BenchmarkResult]) {
|
||||
return;
|
||||
}
|
||||
|
||||
let mut annotated_results = compute_relative_speed(&results);
|
||||
annotated_results.sort_by(|l, r| compare_mean_time(l.result, r.result));
|
||||
if let Some(mut annotated_results) = compute_relative_speed(&results) {
|
||||
annotated_results.sort_by(|l, r| compare_mean_time(l.result, r.result));
|
||||
|
||||
let fastest = &annotated_results[0];
|
||||
let others = &annotated_results[1..];
|
||||
let fastest = &annotated_results[0];
|
||||
let others = &annotated_results[1..];
|
||||
|
||||
println!("{}", "Summary".bold());
|
||||
println!(" '{}' ran", fastest.result.command.cyan());
|
||||
println!("{}", "Summary".bold());
|
||||
println!(" '{}' ran", fastest.result.command.cyan());
|
||||
|
||||
for item in others {
|
||||
println!(
|
||||
"{} ± {} times faster than '{}'",
|
||||
format!("{:8.2}", item.relative_speed).bold().green(),
|
||||
format!("{:.2}", item.relative_speed_stddev).green(),
|
||||
&item.result.command.magenta()
|
||||
for item in others {
|
||||
println!(
|
||||
"{} ± {} times faster than '{}'",
|
||||
format!("{:8.2}", item.relative_speed).bold().green(),
|
||||
format!("{:.2}", item.relative_speed_stddev).green(),
|
||||
&item.result.command.magenta()
|
||||
);
|
||||
}
|
||||
} else {
|
||||
eprintln!(
|
||||
"{}: The benchmark comparison could not be computed as some benchmark times are zero. \
|
||||
This could be caused by background interference during the initial calibration phase \
|
||||
of hyperfine, in combination with very fast commands (faster than a few milliseconds). \
|
||||
Try to re-run the benchmark on a quiet system. If it does not help, you command is \
|
||||
most likely too fast to be accurately benchmarked by hyperfine.",
|
||||
"Note".bold().red()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -125,12 +143,11 @@ fn test_max() {
|
||||
assert_eq!(1.0, max(&[-1.0, 1.0, 0.0]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_compute_relative_speed() {
|
||||
use approx::assert_relative_eq;
|
||||
#[cfg(test)]
|
||||
fn create_result(name: &str, mean: Scalar) -> BenchmarkResult {
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
let create_result = |name: &str, mean| BenchmarkResult {
|
||||
BenchmarkResult {
|
||||
command: name.into(),
|
||||
mean,
|
||||
stddev: 1.0,
|
||||
@@ -141,7 +158,12 @@ fn test_compute_relative_speed() {
|
||||
max: mean,
|
||||
times: None,
|
||||
parameters: BTreeMap::new(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_compute_relative_speed() {
|
||||
use approx::assert_relative_eq;
|
||||
|
||||
let results = vec![
|
||||
create_result("cmd1", 3.0),
|
||||
@@ -149,13 +171,22 @@ fn test_compute_relative_speed() {
|
||||
create_result("cmd3", 5.0),
|
||||
];
|
||||
|
||||
let annotated_results = compute_relative_speed(&results);
|
||||
let annotated_results = compute_relative_speed(&results).unwrap();
|
||||
|
||||
assert_relative_eq!(1.5, annotated_results[0].relative_speed);
|
||||
assert_relative_eq!(1.0, annotated_results[1].relative_speed);
|
||||
assert_relative_eq!(2.5, annotated_results[2].relative_speed);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_compute_relative_speed_for_zero_times() {
|
||||
let results = vec![create_result("cmd1", 1.0), create_result("cmd2", 0.0)];
|
||||
|
||||
let annotated_results = compute_relative_speed(&results);
|
||||
|
||||
assert!(annotated_results.is_none());
|
||||
}
|
||||
|
||||
pub fn tokenize<'a>(values: &'a str) -> Vec<String> {
|
||||
let mut tokens = vec![];
|
||||
let mut buf = String::new();
|
||||
|
||||
@@ -13,7 +13,7 @@ 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.
|
||||
/// where MAD is the median absolute deviation.
|
||||
///
|
||||
/// References:
|
||||
/// - <https://en.wikipedia.org/wiki/Median_absolute_deviation>
|
||||
|
||||
+47
-34
@@ -16,7 +16,7 @@ use crate::hyperfine::export::{ExportManager, ExportType};
|
||||
use crate::hyperfine::internal::{tokenize, write_benchmark_comparison};
|
||||
use crate::hyperfine::parameter_range::get_parameterized_commands;
|
||||
use crate::hyperfine::types::{
|
||||
BenchmarkResult, CmdFailureAction, Command, HyperfineOptions, OutputStyleOption, ParameterValue,
|
||||
CmdFailureAction, Command, HyperfineOptions, OutputStyleOption, ParameterValue,
|
||||
};
|
||||
use crate::hyperfine::units::Unit;
|
||||
|
||||
@@ -27,7 +27,11 @@ pub fn error(message: &str) -> ! {
|
||||
}
|
||||
|
||||
/// Runs the benchmark for the given commands
|
||||
fn run(commands: &[Command<'_>], options: &HyperfineOptions) -> io::Result<Vec<BenchmarkResult>> {
|
||||
fn run(
|
||||
commands: &[Command<'_>],
|
||||
options: &HyperfineOptions,
|
||||
export_manager: &ExportManager,
|
||||
) -> io::Result<()> {
|
||||
let shell_spawning_time =
|
||||
mean_shell_spawning_time(&options.shell, options.output_style, options.show_output)?;
|
||||
|
||||
@@ -45,57 +49,65 @@ fn run(commands: &[Command<'_>], options: &HyperfineOptions) -> io::Result<Vec<B
|
||||
// Run the benchmarks
|
||||
for (num, cmd) in commands.iter().enumerate() {
|
||||
timing_results.push(run_benchmark(num, cmd, shell_spawning_time, options)?);
|
||||
|
||||
// Export (intermediate) results
|
||||
let ans = export_manager.write_results(&timing_results, options.time_unit);
|
||||
if let Err(e) = ans {
|
||||
error(&format!(
|
||||
"The following error occurred while exporting: {}",
|
||||
e
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(timing_results)
|
||||
// Print relative speed comparison
|
||||
if options.output_style != OutputStyleOption::Disabled {
|
||||
write_benchmark_comparison(&timing_results);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let matches = get_arg_matches(env::args_os());
|
||||
let options = build_hyperfine_options(&matches);
|
||||
let export_manager = build_export_manager(&matches);
|
||||
let commands = build_commands(&matches);
|
||||
let export_manager = match build_export_manager(&matches) {
|
||||
Ok(export_manager) => export_manager,
|
||||
Err(ref e) => error(&e.to_string())
|
||||
};
|
||||
|
||||
let res = match options {
|
||||
Ok(ref opts) => run(&commands, &opts),
|
||||
Ok(ref opts) => run(&commands, &opts, &export_manager),
|
||||
Err(ref e) => error(&e.to_string()),
|
||||
};
|
||||
|
||||
match res {
|
||||
Ok(timing_results) => {
|
||||
let options = options.unwrap();
|
||||
|
||||
if options.output_style != OutputStyleOption::Disabled {
|
||||
write_benchmark_comparison(&timing_results);
|
||||
}
|
||||
|
||||
let ans = export_manager.write_results(timing_results, options.time_unit);
|
||||
if let Err(e) = ans {
|
||||
error(&format!(
|
||||
"The following error occurred while exporting: {}",
|
||||
e
|
||||
));
|
||||
}
|
||||
}
|
||||
Ok(_) => {}
|
||||
Err(e) => error(&e.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Build the HyperfineOptions that correspond to the given ArgMatches
|
||||
fn build_hyperfine_options(matches: &ArgMatches<'_>) -> Result<HyperfineOptions, OptionsError> {
|
||||
fn build_hyperfine_options<'a>(
|
||||
matches: &ArgMatches<'a>,
|
||||
) -> Result<HyperfineOptions, OptionsError<'a>> {
|
||||
let mut options = HyperfineOptions::default();
|
||||
let param_to_u64 = |param| {
|
||||
matches
|
||||
.value_of(param)
|
||||
.and_then(|n| u64::from_str_radix(n, 10).ok())
|
||||
.map(|n| {
|
||||
u64::from_str_radix(n, 10).map_err(|e| OptionsError::NumericParsingError(param, e))
|
||||
})
|
||||
.transpose()
|
||||
};
|
||||
|
||||
options.warmup_count = param_to_u64("warmup").unwrap_or(options.warmup_count);
|
||||
options.warmup_count = param_to_u64("warmup")?.unwrap_or(options.warmup_count);
|
||||
|
||||
let mut min_runs = param_to_u64("min-runs");
|
||||
let mut max_runs = param_to_u64("max-runs");
|
||||
let mut min_runs = param_to_u64("min-runs")?;
|
||||
let mut max_runs = param_to_u64("max-runs")?;
|
||||
|
||||
if let Some(runs) = param_to_u64("runs") {
|
||||
if let Some(runs) = param_to_u64("runs")? {
|
||||
min_runs = Some(runs);
|
||||
max_runs = Some(runs);
|
||||
}
|
||||
@@ -193,20 +205,21 @@ fn build_hyperfine_options(matches: &ArgMatches<'_>) -> Result<HyperfineOptions,
|
||||
|
||||
/// Build the ExportManager that will export the results specified
|
||||
/// in the given ArgMatches
|
||||
fn build_export_manager(matches: &ArgMatches<'_>) -> ExportManager {
|
||||
fn build_export_manager(matches: &ArgMatches<'_>) -> io::Result<ExportManager> {
|
||||
let mut export_manager = ExportManager::new();
|
||||
{
|
||||
let mut add_exporter = |flag, exporttype| {
|
||||
let mut add_exporter = |flag, exporttype| -> io::Result<()> {
|
||||
if let Some(filename) = matches.value_of(flag) {
|
||||
export_manager.add_exporter(exporttype, filename);
|
||||
export_manager.add_exporter(exporttype, filename)?;
|
||||
}
|
||||
Ok(())
|
||||
};
|
||||
add_exporter("export-asciidoc", ExportType::Asciidoc);
|
||||
add_exporter("export-json", ExportType::Json);
|
||||
add_exporter("export-csv", ExportType::Csv);
|
||||
add_exporter("export-markdown", ExportType::Markdown);
|
||||
add_exporter("export-asciidoc", ExportType::Asciidoc)?;
|
||||
add_exporter("export-json", ExportType::Json)?;
|
||||
add_exporter("export-csv", ExportType::Csv)?;
|
||||
add_exporter("export-markdown", ExportType::Markdown)?;
|
||||
}
|
||||
export_manager
|
||||
Ok(export_manager)
|
||||
}
|
||||
|
||||
/// Build the commands to benchmark
|
||||
|
||||
Reference in new issue
Block a user