Benchmark functions with Criterion

Hello everyone!

This might be a simple question but I couldn't find any help online.

I want to benchmark some functions. The crate I want to use is criterion.
The benchmark is in myProject/bench/benchmark.rs the functions I want to benchmark are in myProject/src/utils/function.rs .
How do I import the functions into the benchmark?

I would be really happy if someone could answer my question!

The functions have to be exported from your library crate. If your package (project) does not already have a library crate, you will need to add one — src/lib.rs — and move modules from your src/main.rs to it.

https://doc.rust-lang.org/cargo/guide/project-layout.html

This solution works. Thanks for the help!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.