Skip to main content
Instruments are a key component of CodSpeed. They are used to measure the performance of your code using different techniques.

Choosing an Instrument

Not sure which instrument to use? This decision tree will help you find the right one:
  • CPU Simulation: Simulates CPU behavior to measure performance, taking into account instructions executed, cache and memory access patterns. Benchmarks run only once for consistent, hardware-agnostic results.
  • Walltime: Measures real-world execution time on bare-metal runners managed by CodSpeed, with low noise and high precision.
  • Memory: Captures detailed memory usage and heap allocations to help you identify and optimize allocations.
* Simulation is the recommended default, but use Walltime when your benchmark contains I/O (which can introduce variance in simulation) or is too large (simulation adds overhead that slows down long-running benchmarks significantly).

Executor Instruments

Ad Hoc Instruments

Those ad hoc instruments can be used on top of an executor instrument to measure specific performance metrics.