[][src]Function testbench::concurrent_benchmark

pub fn concurrent_benchmark(
    num_iterations: u32,
    iteration_func: impl FnMut(),
    antagonist_func: impl FnMut() + Send + 'static
)

Microbenchmark some operation while another is running in a loop

For multithreaded code, benchmarking the performance of isolated operations is usually only half of the story. Synchronization and memory contention can also have a large impact on performance.

For this reason, it is often useful to also measure the performance of one operation as another "antagonist" operation is also running in a background thread. This function implements such concurrent benchmarking.