Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Benchmarks

The benchmarks in benches/ use Criterion and cover the hot paths: spawning, iteration, ticking, reduction, query matching, scheduler packing, structural mutation, parallel scaling, and the GPU paths.

Running

Compile all benchmarks without running (this is what CI checks):

cargo bench --no-run --all-features

Run a benchmark with the features it needs:

cargo bench --all-features --bench iterate

Some benchmark targets declare required features (for example, the environment, messaging, model, and GPU benchmarks); Cargo only builds a target when its features are enabled.

Measuring a change

When a change is meant to affect performance:

  1. Measure the relevant benchmark before and after, on the same machine, in release.
  2. Report the numbers with their full context — hardware, features, build profile, population, and command — as described in performance methodology.
  3. Confirm the change did not alter a trajectory for a fixed seed unless that was the intent; a performance change should not be a behavioural change by accident.

Attributing time

Use the profiler to see where a tick spends its time before optimising. A benchmark shows whether a change helped; the profiler shows where the time goes.