mirror of
https://github.com/uutils/coreutils
synced 2024-12-12 22:32:53 +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" }
|
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" }
|
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" }
|
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
|
# * pinned transitive dependencies
|
||||||
# Not needed for now. Keep as examples:
|
# Not needed for now. Keep as examples:
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
# Benchmarking `factor`
|
# 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
|
## Microbenchmarking deterministic functions
|
||||||
|
|
||||||
We currently use [`criterion`] to benchmark deterministic functions,
|
We currently use [`criterion`] to benchmark deterministic functions,
|
||||||
such as `gcd` and `table::factor`.
|
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
|
However, µbenchmarks are by nature unstable: not only are they specific to
|
||||||
the hardware, operating system version, etc., but they are noisy and affected
|
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
|
by other tasks on the system (browser, compile jobs, etc.), which can cause
|
||||||
|
|
|
@ -17,25 +17,15 @@ num-traits = "0.2.13" # used in src/numerics.rs, which is included by build.rs
|
||||||
[dependencies]
|
[dependencies]
|
||||||
coz = { version = "0.1.3", optional = true }
|
coz = { version = "0.1.3", optional = true }
|
||||||
num-traits = "0.2.13" # Needs at least version 0.2.13 for "OverflowingAdd"
|
num-traits = "0.2.13" # Needs at least version 0.2.13 for "OverflowingAdd"
|
||||||
rand = { version="0.7", features=["small_rng"] }
|
rand = { version = "0.7", features = ["small_rng"] }
|
||||||
smallvec = { version="0.6.14, < 1.0" }
|
smallvec = { version = "0.6.14, < 1.0" }
|
||||||
uucore = { version=">=0.0.8", package="uucore", path="../../uucore" }
|
uucore = { version = ">=0.0.8", package = "uucore", path = "../../uucore" }
|
||||||
uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" }
|
uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
array-init = "2.0.0"
|
|
||||||
criterion = "0.3"
|
|
||||||
paste = "0.1.18"
|
paste = "0.1.18"
|
||||||
quickcheck = "0.9.2"
|
quickcheck = "0.9.2"
|
||||||
rand_chacha = "0.2.2"
|
|
||||||
|
|
||||||
[[bench]]
|
|
||||||
name = "gcd"
|
|
||||||
harness = false
|
|
||||||
|
|
||||||
[[bench]]
|
|
||||||
name = "table"
|
|
||||||
harness = false
|
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "factor"
|
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