Performance Benchmarks

AgentDiff ships a pytest-benchmark suite that measures the engine at scale. It is deliberately excluded from the regular test run - invoke it with:

bash
make bench

Results are autosaved under .benchmarks/ (gitignored), so you can compare a branch against main with --benchmark-compare.

What is measured

BenchmarkScalesWhat it tells you
align_traces100 / 500 / 1000 stepsThe core LCS alignment - the engine's dominant cost.
compare end-to-end100 / 500 / 1000 stepsEverything combined: align + metrics + loops.
Loop detection100 / 500 / 1000 steps, plus a pathological single-tool repeatSequence/cycle scanning cost.
Recovery metrics1000 steps with error clustersWEI + Recovery Step Ratio overhead.
OpenInference parsing1000 spansAdapter ingestion cost at OTel-export scale.
Report serialization500-step diffJSON export cost.

Baseline findings (2026-08, M-series laptop)

  • LCS alignment dominates everything: ~16ms at 100 steps grows to ~1.6s at 1000 steps - quadratic-ish growth, as expected for sequence alignment.
  • Everything else is noise by comparison: loop detection ~3ms and adapter parsing ~17ms at 1000 elements; recovery/WEI computation is sub-millisecond.
  • Practical implication: trace ingestion is never the bottleneck - very large traces strain the aligner first. That is why incremental/streaming ingestion was descoped in favor of these measurements.

If you touch the aligner or add per-step work to compare(), run make bench before and after - a regression here is invisible to the unit suite's runtime but real for users gating large trajectories in CI.