Function bench

Source
pub fn bench<F, O>(f: F) -> Stats
where F: Fn() -> O,
Expand description

Run a benchmark.

The return value of f is not used, but we trick the optimiser into thinking we’re going to use it. Make sure to return enough information to prevent the optimiser from eliminating code from your benchmark! (See the module docs for more.)