Expand description
Count values processed in each iteration to measure throughput.
§Examples
The following example measures throughput of converting
&[i32] into Vec<i32> by providing BytesCount
via Bencher::counter:
use divan::counter::BytesCount;
#[divan::bench]
fn slice_into_vec(bencher: divan::Bencher) {
let ints: &[i32] = &[
// ...
];
let bytes = BytesCount::of_slice(ints);
bencher
.counter(bytes)
.bench(|| -> Vec<i32> {
divan::black_box(ints).into()
});
}Structs§
- Bytes
Count - Process N bytes.
- Chars
Count - Process N
chars. - Cycles
Count - Process N cycles, displayed as Hertz.
- Items
Count - Process N items.
Enums§
- Bytes
Format - The numerical base for
BytesCountin benchmark outputs.
Traits§
- Counter
- Counts the number of values processed in each iteration of a benchmarked function.
- Into
Counter - Conversion into a
Counter.