Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can Criterion measure things after doing a per-iteration setup? #8

Open
faern opened this issue May 5, 2020 · 0 comments · May be fixed by #27
Open

Can Criterion measure things after doing a per-iteration setup? #8

faern opened this issue May 5, 2020 · 0 comments · May be fixed by #27

Comments

@faern
Copy link
Owner

faern commented May 5, 2020

Currently we have one benchmark to measure the time it takes to create a channel and another one to measure how long it takes to create a channel plus send a message on it. Because the channel is consumed by the send we need a new channel for each iteration. But does Criterion allow doing a per-iteration setup and then start timing? Something like:

b.iter(|| {
    let (sender, _receiver) = oneshot::channel();
    // Start measure time here!
    sender.send(black_box(value_fn())).unwrap()
});

If not, does it allow pairing one benchmark with another and say that the result of one should be subtracted from the other before presenting it? 🤷

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 a pull request may close this issue.

1 participant