FeaturesBlogDocsPricingExploreChangelog
Login
Get Started

Changelog

New updates and improvements released to Codspeed.
Follow us on

Divan Support for Rust

Divan Support for Rust

We're excited to announce a new Rust integration with Divan 🛋️, a fast and simple benchmarking framework! 🚀

Divan offers a straightforward API that simplifies the benchmarking process, allowing you to register benchmarks with ease. Unlike Criterion.rs, which can be more complex, or Bencher, which is less feature-rich, Divan provides a balanced approach with its user-friendly interface and powerful capabilities.

Here's an example of how you can use Divan to benchmark a function:

/// benches/fibonacci.rs

fn main() {
    // Run registered benchmarks.
    divan::main();
}

// Register a `fibonacci` function and benchmark it over multiple cases.
#[divan::bench(args = [1, 2, 4, 8, 16, 32])]
fn fibonacci(n: u64) -> u64 {
    if n <= 1 {
        1
    } else {
        fibonacci(n - 2) + fibonacci(n - 1)
    }
}

The divan::bench macro brings a very idiomatic and easy-to-use way to define and customize benchmarks. Bringing this closer to standard test definition while we're waiting on custom test frameworks to be stabilized.

Try it now by checking out our integration guide in the documentation to get started with using Divan in your Rust projects.

Stop Guessing,
Start Measuring.

Resources Home PricingDocs BlogGitHub Changelog Advent 🎄

{176023}Analyzed Commits
Explore Repos

Backed by
Copyright © 2025 CodSpeed Technology