Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upClarify whether binary crates and private functions can be benchmarked #158
Comments
This comment has been minimized.
This comment has been minimized.
|
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." |
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
Seeker14491
commented
Jun 26, 2018
|
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? |
bheisler
added this to the Version 0.2.4 milestone
Jun 29, 2018
added a commit
that referenced
this issue
Jun 30, 2018
This comment has been minimized.
This comment has been minimized.
|
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! |
Seeker14491 commentedJun 26, 2018
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.