Overview
codspeed-criterion-compat is a Criterion.rs compatibility layer for CodSpeed that allows you to seamlessly integrate existing Criterion benchmarks with CodSpeed performance measurement.
This crate acts as a drop-in replacement for Criterion, maintaining your existing benchmark code while enabling CodSpeed integration.
Installation
This will install the
codspeed-criterion-compat crate and rename it to criterion in your Cargo.toml.
This way, you can keep your existing imports and the compatibility layer will take care of the rest.Using the compatibility layer won’t change the behavior of your benchmark suite and criterion will still run it as usual.If you prefer, you can also install codspeed-criterion-compat as is and change your imports to use this new crate name.Usage
Let’s start with the example from the Criterion.rs documentation, creating a benchmark suite for the Fibonacci function (inbenches/my_benchmark.rs):
Cargo.toml:
Cargo.toml
cargo-codspeed:
Compatibility
Not (yet) supported
iter_customwith_filter