Crates.io | criterion-decimal-throughput |
lib.rs | criterion-decimal-throughput |
version | 1.0.2 |
source | src |
created_at | 2022-07-23 22:23:25.291753 |
updated_at | 2022-08-29 13:09:20.665649 |
description | Criterion.rs measurement for decimal throughput (MB/s, GB/s, etc.) |
homepage | |
repository | https://github.com/V0ldek/criterion-decimal-throughput |
max_upload_size | |
id | 631737 |
size | 44,225 |
criterion-decimal-throughput
– KB/s, MB/s, GB/s in Criterion.rs outputsCustom measurement format for Criterion.rs that displays throughput in decimal byte-multiples (KB/s, MB/s, GB/s) instead of binary (KiB/s, MiB/s, GiB/s).
Under default Criterion.rs measurements, the output of a benchmark with throughput configured will look like this:
meaning '1.5050 * 2^(30)' which is fine, I guess, but I'm not good enough at on-the-fly calculations to see at a glance that this is, in fact, a mean of around 1.6 billion bytes. With this crate we get:
which is a much nicer '1.5787e9'. It is quite subjective to prefer one over the other, but Criterion.rs forces you into binary. If you share my preference, this crate allows you to get nicer numbers.
Simply use the provided decimal_byte_measurement
function for default configuration,
or set the DecimalByteMeasurement
type as measurement manually. See the example on docs.rs.
Add criterion-decimal-throughput
as your dev-dependency, either with cargo
:
cargo add --dev criterion-decimal-throughput
Alternatively, add it directly to the dev-dependencies
section of your Cargo.toml
:
[dev-dependencies]
criterion-decimal-throughput = "1.0.0"
Simply use cargo
:
cargo build
cargo test
See Contribution Guide.