Overview
cargo-codspeed is a Cargo subcommand for running performance benchmarks with
CodSpeed. It provides an easy way to build and run benchmarks for Rust projects
with CodSpeed integration.
Installation
With cargo
With cargo-binstall (recommended in CI)
cargo-binstall enables you to
install binaries directly without having to build from the source(with
cargo install) every time.
If you don’t have installed yet, you can install it with:
cargo-codspeed with:
Usage
Building Benchmarks
Build your benchmarks for CodSpeed:Running Benchmarks
Run the previously built benchmarks:The --measurement-mode flag
When building benchmarks, you can specify the measurement mode using the
--measurement-mode / -m flag. This determines which CodSpeed instrument can
be used to run your benchmarks.
--measurement-mode flag can take the following values:
simulation: Runs benchmarks once on a simulated CPU for consistent measurements.walltime: Measures wall-clock time for real-world scenarios.memory: Benchmarks are run once using memory profiling to track heap allocations and memory usage.
--measurement-mode flag, the default behavior is to build for
simulation mode.