Expand description
Throughput measurement for criterion.rs using decimal multiple-byte units.
By default, using criterion.rs throughput measurement gives results in binary multiple-byte units, so KiB/s, MiB/s, etc. Some people, like me, prefer to use the more intuitive decimal multiple-byte units of KB/s, MB/s, and so on. This crate enables that.
Usage
You need to:
- Use the custom measurement type
criterion_decimal_throughput::Criterion
from this crate, exposed with thedecimal_byte_measurement
function. - Enable throughput measurement in the benchmark group with
criterion::BenchmarkGroup::throughput
.
Example
use criterion::{criterion_group, criterion_main};
use criterion_decimal_throughput::{Criterion, decimal_byte_measurement};
fn example_bench(c: &mut Criterion) {
let mut group = c.benchmark_group("example_name");
group.throughput(criterion::Throughput::Bytes(/* Your input size here */ 1_000_000u64));
// Add your benchmarks to the group here...
group.finish();
}
criterion_group!(
name = example;
config = decimal_byte_measurement();
targets = example_bench
);
criterion_main!(example);
Origin
Related criterion.rs issue: https://github.com/bheisler/criterion.rs/issues/581.
Structs
Measurement type for decimal multiple-byte units.
Functions
Construct a default criterion::Criterion
manager with DecimalByteMeasurement
.
Type Definitions
Shorthand for the criterion manager with DecimalByteMeasurement
.