Nightly benchmarks measure Soroban host CPU instructions and memory bytes
for core vault operations. This repo is Stellar/Soroban, so the equivalent of
Foundry forge test --gas-report + Anvil is the Soroban test Env budget
meter plus a scheduled GitHub Actions workflow.
Numbers are relative across commits, not production WASM gas. Host metering underestimates VM instantiation.
| Op | What is measured |
|---|---|
deposit |
Subsequent deposit (after a warm-up deposit) |
withdraw |
Partial share redemption |
invest |
Idle → strategy allocation |
switch_strategy |
set_strategy between two Benji strategy instances (v1 ↔ v2) |
Each op is reported once per strategy version so the nightly issue can compare implementations.
Baseline: contracts/vault/benches/baseline.json
| Field | Value |
|---|---|
regression_threshold_pct |
15 |
| Fail CI | any op's CPU or memory > baseline × 1.15 |
| Compare | max(v1, v2) for that op vs the baseline entry |
If a real, accepted optimisation or feature increases cost, update the baseline in the same PR and explain why in the nightly issue / PR body.
bash contracts/vault/scripts/benchmark.shThe script:
- Runs
cargo test -p vault --test benchmarks -- --nocapture - Parses
BENCH op=... cpu=... mem=...lines - Writes
benchmark-report.mdandbenchmark-results.json - Exits non-zero on a regression against
baseline.json
Nightly: .github/workflows/nightly-benchmarks.yml (02:00 UTC) posts the
report to a GitHub Issue labeled nightly-benchmark.