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).

Language Support

If you need an instrument that isn’t available for your language yet, let us know via Discord or email our support.

Executor Instruments

https://mintcdn.com/codspeed/DYQLS2JiztYwuRW0/assets/icons/dataflow-03-primary.svg?fit=max&auto=format&n=DYQLS2JiztYwuRW0&q=85&s=4a00d3a388b7a6892592a7f54d44466c

CPU Simulation

Measure performance by simulating the CPU behavior
https://mintcdn.com/codspeed/DYQLS2JiztYwuRW0/assets/icons/data-primary.svg?fit=max&auto=format&n=DYQLS2JiztYwuRW0&q=85&s=d73410b814160a15cf20f797c167af08

Memory

Track memory usage, allocations, and leaks in your benchmarks

Walltime

Measure performance by measuring the real time taken

Ad Hoc Instruments

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

Database Instrument

Measure the performance of database queries