-
Notifications
You must be signed in to change notification settings - Fork 321
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
Add Criterion::measurement function #369
Conversation
Huh, that's an interesting idea. I hadn't thought of that! One problem I can foresee is that you now have defined multiple benchmarks with the same name, and those will conflict. |
The benchmark Lines 312 to 316 in 72a27c4
Lines 355 to 365 in 72a27c4
I've changed it anyways. If instead you mean that calling the |
Hey, sorry I was unclear. What I meant was this: On the other hand, I suppose that if you're using |
I added a more complex example showcasing measurement using both Maybe it would make sense to add a note to |
…s it represents the general use-case better
This looks useful to me. Are you up for resolving the conflicts? |
Closing due to inactivity. |
Sorry for the late response. I've rebased my fork to the latest master. |
I can't reopen after you're rebased your branch. You'll have to create a new PR. |
I wanted to write a benchmark function generic over the measurement such that I can easily benchmark once using cycles and once using time (see #355). However, there was no way to generically perform the measurements, which is why I added this function. The clone might not necessarily be required, but otherwise lifetime foo would become complicated, and usually it's a unit-struct anyway.
See the example in the doc-comment for an example use-case.