macro_rules! library_benchmark_group { ( $( config = $config:expr ; $(;)* )? benchmarks = $( $function:ident ),+ ) => { ... }; ( name = $name:ident; $( config = $config:expr ; $(;)* )? benchmarks = ) => { ... }; ( name = $name:ident; $(;)* $( config = $config:expr ; $(;)* )? benchmarks = $( $function:ident ),+ $(,)* ) => { ... }; }
Expand description
Macro used to define a group of library benchmarks
A small introductory example which shows the basic setup. This macro only accepts benchmarks
annotated with #[library_benchmark]
(crate::library_benchmark
).
use iai_callgrind::{library_benchmark_group, library_benchmark};
#[library_benchmark]
fn bench_something() -> u64 {
42
}
library_benchmark_group!(
name = my_group;
benchmarks = bench_something
);
iai_callgrind::main!(library_benchmark_groups = my_group);
To be benchmarked a library_benchmark_group
has to be added to the main!
macro by adding its
name to the library_benchmark_groups
argument of the main!
macro. See there for further
details about the crate::main
macro.
The following top-level arguments are accepted:
library_benchmark_group!(
name = my_group;
config = LibraryBenchmarkConfig::default();
benchmarks = some_func
);
- name (mandatory): A unique name used to identify the group for the
main!
macro - config (optional): A
crate::LibraryBenchmarkConfig
which is applied to all benchmarks within the same group.