Browse documentation

Technical documentation / Reference

Repeated setup benchmark

Credential-free benchmark for startup settings work, repeated classic-prompt setup, ten identical provider overrides, and provider tool-body construction.

Run

ISSUE_379_BENCH_REPETITIONS=50 \
  cargo test --release --locked --lib profile_issue_379_repeated_setup_paths -- --ignored --nocapture

The harness emits seven samples per path with minimum, median, and maximum nanoseconds per operation. Debug builds are useful for correctness checks; use release results for performance decisions. The fixture uses a temporary MC_HOME, local no-auth provider configuration, local profiles, and no network.

Issue #379 implementation run

Run on macOS arm64 in the release profile. Each row used 7 samples and 50 repetitions per sample, except the 4 MiB context-cache rows, which used 25 repetitions.

PathBaseline medianReused medianResult
Startup schema maintenance + config load633.37 µs593.20 µs6% lower
Repeated classic-prompt settings/profile setup99.27 µs0.67 µs99% lower
Ten identical provider overrides2.35 ms8.65 µs99% lower
4 MiB context-cache hit7.58 ms5.27 ms30% lower
Chat tool definitions rebuild/reshape35.64 µs15.05 µs58% lower

Startup is filesystem-sensitive and had overlapping variance (baseline 604.32 to 748.46 µs; reused 586.13 to 618.60 µs). These values are evidence for the local changes, not a hard budget.

Representative provider-body medians from the same run:

Body modeMedian
No tools0.42 µs
Unchanged static tools15.74 µs
One disabled tool66.04 µs
One dynamic tool72.58 µs

Dynamic and filtered tool definitions intentionally keep request-local construction. The unchanged Chat Completions and Anthropic tool shapes use provider-ready immutable caches and take one owned clone at the request-body boundary.

Edit this page on GitHub ↗