mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 14:52:41 +00:00
factor: Move benchmarks out-of-crate
This commit is contained in:
parent
1cd001f529
commit
00322b986b
6 changed files with 41 additions and 19 deletions
|
@ -324,6 +324,9 @@ wc = { optional=true, version="0.0.6", package="uu_wc", path="src/uu/wc" }
|
|||
who = { optional=true, version="0.0.6", package="uu_who", path="src/uu/who" }
|
||||
whoami = { optional=true, version="0.0.6", package="uu_whoami", path="src/uu/whoami" }
|
||||
yes = { optional=true, version="0.0.6", package="uu_yes", path="src/uu/yes" }
|
||||
|
||||
factor_benches = { optional = true, version = "0.0.0", package = "uu_factor_benches", path = "tests/benches/factor" }
|
||||
|
||||
#
|
||||
# * pinned transitive dependencies
|
||||
# Not needed for now. Keep as examples:
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
# Benchmarking `factor`
|
||||
|
||||
The benchmarks for `factor` are located under `tests/benches/factor`
|
||||
and can be invoked with `cargo bench` in that directory.
|
||||
|
||||
They are located outside the `uu_factor` crate, as they do not comply
|
||||
with the project's minimum supported Rust version, *i.e.* may require
|
||||
a newer version of `rustc`.
|
||||
|
||||
|
||||
## Microbenchmarking deterministic functions
|
||||
|
||||
We currently use [`criterion`] to benchmark deterministic functions,
|
||||
such as `gcd` and `table::factor`.
|
||||
|
||||
Those benchmarks can be simply executed with `cargo bench` as usual,
|
||||
but may require a recent version of Rust, *i.e.* the project's minimum
|
||||
supported version of Rust does not apply to the benchmarks.
|
||||
|
||||
|
||||
However, µbenchmarks are by nature unstable: not only are they specific to
|
||||
the hardware, operating system version, etc., but they are noisy and affected
|
||||
by other tasks on the system (browser, compile jobs, etc.), which can cause
|
||||
|
|
|
@ -23,19 +23,9 @@ uucore = { version=">=0.0.8", package="uucore", path="../../uucore" }
|
|||
uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" }
|
||||
|
||||
[dev-dependencies]
|
||||
array-init = "2.0.0"
|
||||
criterion = "0.3"
|
||||
paste = "0.1.18"
|
||||
quickcheck = "0.9.2"
|
||||
rand_chacha = "0.2.2"
|
||||
|
||||
[[bench]]
|
||||
name = "gcd"
|
||||
harness = false
|
||||
|
||||
[[bench]]
|
||||
name = "table"
|
||||
harness = false
|
||||
|
||||
[[bin]]
|
||||
name = "factor"
|
||||
|
|
26
tests/benches/factor/Cargo.toml
Normal file
26
tests/benches/factor/Cargo.toml
Normal file
|
@ -0,0 +1,26 @@
|
|||
[package]
|
||||
name = "uu_factor_benches"
|
||||
version = "0.0.0"
|
||||
authors = ["nicoo <nicoo@debian.org>"]
|
||||
license = "MIT"
|
||||
description = "Benchmarks for the uu_factor integer factorization tool"
|
||||
homepage = "https://github.com/uutils/coreutils"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
uu_factor = { path = "../../../src/uu/factor" }
|
||||
|
||||
[dev-dependencies]
|
||||
array-init = "2.0.0"
|
||||
criterion = "0.3"
|
||||
rand = "0.7"
|
||||
rand_chacha = "0.2.2"
|
||||
|
||||
|
||||
[[bench]]
|
||||
name = "gcd"
|
||||
harness = false
|
||||
|
||||
[[bench]]
|
||||
name = "table"
|
||||
harness = false
|
Loading…
Reference in a new issue