bench

Attribute Macro bench 

Source
#[bench]
Available on crate features unstable and unsound only.
Expand description

A procedural macro for running a benchmark in a separate process.

§Example

Use the attribute for all benchmarks in scope:

use test_fork::bench;

#[bench]
fn bench1(b: &mut Bencher) {
  b.iter(|| sleep(Duration::from_millis(1)));
}

Use it only on a single benchmark:

#[test_fork::bench]
fn bench2(b: &mut Bencher) {
  b.iter(|| sleep(Duration::from_millis(1)));
}