I am new to benchmark tests in rust and encountered a issue that I don't really understand.
I am using Criterion 0.4 to build my benchmark tests. And I am able to get valid benchmark report using
cargo bench. But when I try to compile first with
cargo bench --no-run and execute the executable separately. But I can't get the same report that I got from running
cargo bench only.
Does anyone know why it's like that? Is it related to how
rustc run the benchmark tests? I saw that in Criterion doc, I could use
cargo test --benches to run benchmark tests without mearsurement or analysis. And that produces the same output as executing the executable separately.
Could anyone give me some guidance on how to run the compiled executable of benchmark tests?
I believe you just need to pass
--benches when you run the built executable, but I don't have a criterion setup handy to confirm with
Yes, it does solve the problem. Thank you so much.