How to use cargo bench for long-running functions?
⚓ Rust 📅 2025-10-01 👤 surdeus 👁️ 8Hi rustaceans. I have some code which i'm benchmarking using cargo +nightly bench. The function i'm benchmarking (compiling a shader) takes 5-10 seconds. Cargo's benchmark runner doesn't seem to react intelligently to this, as it keeps running this benchmark for 5-10 minutes before it finally exits and prints the benchmark results.
I see in the test crate's code there is already support for running benchmarks once instead of multiple times, but i see no documented way to trigger this behavior.
How can I use cargo bench to benchmark this code without having to wait 5 minutes every time I want to see a result?
1 post - 1 participant
🏷️ Rust_feed