Skip to content

Add optional async setup for iter_batch#656

Open
samtay wants to merge 1 commit intobheisler:masterfrom
samtay:async-setup
Open

Add optional async setup for iter_batch#656
samtay wants to merge 1 commit intobheisler:masterfrom
samtay:async-setup

Conversation

@samtay
Copy link
Copy Markdown

@samtay samtay commented Feb 16, 2023

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.

@r-warfield
Copy link
Copy Markdown

This would be really helpful!! I would prefer not to use iter_custom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AsyncBencher::iter_batched() setup closure to return a Future

2 participants