criterion-inverted-throughput 0.1.0

Custom criterion measurement to get thropughts in the format [time]/[elements or bytes]
Documentation
  • Coverage
  • 100%
    3 out of 3 items documented1 out of 3 items with examples
  • Size
  • Source code size: 29.69 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.66 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 40s Average build duration of successful builds.
  • all releases: 40s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • loloicci/criterion-inverted-throughput
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • loloicci

Criterion Inverted Throughput

Custom criterion measurement to get thropughts in the format [time]/[elements or bytes]

Description

With deafult criterion config, result of throughput measurement is printed like:

time:   [2.8617 µs 2.8728 µs 2.8850 µs]
thrpt:  [14.558 Melem/s 14.620 Melem/s 14.677 Melem/s]

Throughput is got in the format [elements or bytes]/s. It is fine as a throughput, but sometimes we want to get how much time is cost per 1 element or byte.

Using this crate, we can got it in the format [time]/[element or byte] without post-processing calculations, like:

time:   [2.8581 µs 2.8720 µs 2.8917 µs]
thrpt:  [68.849 ns/elem 68.381 ns/elem 68.049 ns/elem]

Usage

Specify InvertedThroughput as the measurement in your benchmarks.

Example

criterion_group!(
    name = Fum;
    // specify `InvertedThroughput` as measurement
    config = Criterion::default().with_measurement(InvertedThroughput::new());
    targets = bench_foo
);
criterion_main!(Foo);