criterion.rs icon indicating copy to clipboard operation
criterion.rs copied to clipboard

Add optional async setup for iter_batch

Open samtay opened this issue 1 year ago • 0 comments

This improves usability in async contexts. For example you might have

struct Struct;

impl Struct {
    pub fn new() -> Self { Self }
    pub async fn init_phase(&mut self) {}
    pub async fn something_worth_benchmarking(&self) {}
}

but currently you can't use init_phase in the iter_batch setup.

I decided to just offer a new variant so that this wouldn't be a breaking change. I've also got a different version (ref 7d12e73) that updates all the async benchers to allow async setups. If that's preferable, let me know and I'll push that instead.

Closes #576.

samtay avatar Feb 16 '23 08:02 samtay