-
Notifications
You must be signed in to change notification settings - Fork 319
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
Clarify whether binary crates and private functions can be benchmarked #158
Comments
I think the part of the docs to be clarified is "This means that it's not currently possible to include benchmarks in the src/ directory." |
Hey, thanks for trying Criterion.rs. As far as I'm aware, it should be possible to call public functions in a binary crate in your benchmarks. I can't think of anything that would prevent that. Could you share more details? As for benchmarking non-public functions, this is not possible. Cargo does not expose any way for Criterion.rs to define benchmarks in the main crate (ie. in the |
Regarding binary crates: writing
Therefore I cannot reference anything in the Regarding benchmarking non-public functions, might it be possible after the Custom test frameworks RFC is implemented? |
It looks like no crates can depend on a binary crate, so external tests and benchmarks don't work - see rust-lang/cargo#4316 for more details. I've expanded and reworded the Known Limitations section in the User Guide to explain this in more detail. Thanks for the suggestion! |
I have a binary crate that has some functions I want to benchmark, but upon trying to use Criterion, it seems to me that binary crates are not supported, as I can't call into functions that are in a binary crate. Additionally, it's unclear how to benchmark functions that are not part of a crate's public API.
The text was updated successfully, but these errors were encountered: