criterion

Macro criterion_group

Source
macro_rules! criterion_group {
    (name = $name:ident; config = $config:expr; targets = $( $target:path ),+ $(,)*) => { ... };
    ($name:ident, $( $target:path ),+ $(,)*) => { ... };
}
Expand description

Macro used to define a benchmark group for the benchmark harness; see the criterion_main! macro for more details.

This is used to define a benchmark group; a collection of related benchmarks which share a common configuration. Accepts two forms which can be seen below.

ยงExamples:

Complete form:

criterion_group!{
    name = benches;
    config = Criterion::default();
    targets = bench_method1, bench_method2
}

In this form, all of the options are clearly spelled out. This expands to a function named benches, which uses the given config expression to create an instance of the Criterion struct. This is then passed by mutable reference to the targets.

Compact Form:

criterion_group!(benches, bench_method1, bench_method2);

In this form, the first parameter is the name of the group and subsequent parameters are the target methods. The Criterion struct will be created using the Criterion::default() function. If you wish to customize the configuration, use the complete form and provide your own configuration function.