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

Is there a way to bench a function that runs very slow? #306

Closed
liufuyang opened this issue Jul 5, 2019 · 2 comments
Closed

Is there a way to bench a function that runs very slow? #306

liufuyang opened this issue Jul 5, 2019 · 2 comments

Comments

@liufuyang
Copy link

For example I have a function that might take 1 minutes to finish running, is there a way to bench a function to only let it run once or twice?

@bheisler
Copy link
Owner

bheisler commented Jul 9, 2019

Hey, thanks for trying Criterion.rs.

Unfortunately, for this use-case Criterion.rs may not be the best solution (or at least, not as it is now). If you have very long-running benchmarks you probably don't need clever statistics to determine if you've improved or regressed the performance of your code, you can just run it under /usr/bin/time and look at the numbers. Or, alternately, roll your own very simple "benchmarking framework" by just calling Instant::now() before and after calling your minute-long function.

With that said, it is inconvenient to have to have two separate classes of benchmarks; it would be nice to be able to include slow benchmarks in Criterion.rs' reports and similar. I do plan to improve Criterion.rs' support for this use case, but it's not currently a priority. It won't be available for quite some time.

@liufuyang
Copy link
Author

Thank you for your input. I think it totally makes sense :)

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

No branches or pull requests

2 participants