benchmark_stage

Attribute Macro benchmark_stage 

Source
#[benchmark_stage]
Expand description

Wraps functions for a staged benchmark

Attribute options:

  • i number of iterations, required
  • name custom stage name (the default is function name)
  • check check for the result, the function body MUST (not return but) END with a bool

If a function name starts with test_ or benchmark_, the prefix is automatically stripped.

Example:

#[benchmark_stage(i=1_000)]
fn test1() {
    // do something
}
#[benchmark_stage(i=1_000,name=stage1)]
fn test1() {
    // do something
}
#[benchmark_stage(i=1_000,name=stage1,check)]
fn test1() {
    File::create("/tmp/test123").is_ok()
}

ยงPanics

Will panic on invalid options