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

No way to create a BenchmarkId with a function but without a parameter #640

Open
CraftSpider opened this issue Dec 23, 2022 · 1 comment

Comments

@CraftSpider
Copy link

The problem:

Currently, there exists new to create from a function name and parameter, and from_parameter for creating just from a parameter. IntoBenchmarkId lets strings become a BenchmarkId with just a function name, yet it isn't publicly exported.

Why is this needed:

Some methods, such as bench_with_input on Criterion, take a BenchmarkId instead of any IntoBenchmarkId. This could be changed to take a generic, but I think even if that happens it makes sense to add this functionality anyways.

Desired solution:

A from_function or similar function to create a BenchmarkId with just a function name

@CraftSpider
Copy link
Author

I just realized that bench_with_input internally unwraps parameter - so this wouldn't work nicely with how the library treats benchmark IDs. I guess this may just be me using the library not how it was expected, is there a 'proper' way to provide the bench of a function with a parameter when you're just using it as a way to automatically black-box the parameter (such as to provide a &self to every call)?

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

1 participant