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:
- Measure the relevant benchmark before and after, on the same machine, in release.
- Report the numbers with their full context — hardware, features, build profile, population, and command — as described in performance methodology.
- 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.