pub fn bench_diff_with_status(
unit: LatencyUnit,
f1: impl FnMut(),
f2: impl FnMut(),
exec_count: usize,
header: impl FnOnce(LatencyUnit, usize),
) -> DiffOut
Expand description
Compares latencies for two closures f1
and f2
and outputs information about the benchmark and its
execution status. Execution status is output to stderr
.
This function repeatedly executes duos of pairs (f1
, f2
), (f2
, f1
) and collects the resulting
latency data in a DiffOut
object.
Prior to data collection, the benchmark is “warmed-up” by executing the duos of pairs for
get_warmup_millis
milliseconds.
This function calls bench_diff_x
with pre-defined closures for the arguments that support the output of
benchmark status to stderr
.
Arguments:
unit
- the unit used for data collection.f1
- first target for comparison.f2
- second target for comparison.exec_count
- number of executions (sample size) for each function.header
- is invoked once at the start of this function’s execution; it can be used, for example, to output information about the functions being compared tostdout
and/orstderr
. The first argument is the theLatencyUnit
and the second argument is theexec_count
.