Concurrent testing and benchmarking tools in Rust

I love cargo test. It's easy to use, easy to understand, and works pretty well. But while developing triple_buffer and spmc_buffer, I figured out that I needed a couple of extras beyond what it provides:

  • Benchmarking (cargo bench is forever unstable, and even if it were stable I'm not sure it'd fit).
  • Concurrent testing and benchmarking (i.e. test/benchmark some repetitive operation while another is running in a loop in the background).

Since a quick search on gave no interesting result, and the amount of required code is ultimately quite small, I decided to hack my own facilities for triple_buffer. But then I faced exactly the same issues for spmc_buffer, of course. As a temporary workaround, I went for copy-pasting the testing code of triple-buffer, but this is obviously not something I want to stay around in the long run.

The key question is thus this:

  • Are there some nice libraries for concurrent testing & benchmarking that I missed on
  • Or should I roll out a new crate, and spend some extra time thinking about how I could generalize my quick and dirty test/bench code for other people's needs?
1 Like

I'm not familiar with any crates that do that, but even if there were I'd say make a crate if you've got a need :slight_smile:

Maybe you'll end up with a nicely decoupled piece of code to use in your projects, save yourself some future copy+pasta, or it'll help spread new ideas in the ecosystem, or become a de-facto tool. Whatever happens it's positive.