Skip to content

Perf/snapshot bench overhead#1030

Open
Agbasimere wants to merge 14 commits intodotandev:mainfrom
Agbasimere:perf/snapshot-bench-overhead
Open

Perf/snapshot bench overhead#1030
Agbasimere wants to merge 14 commits intodotandev:mainfrom
Agbasimere:perf/snapshot-bench-overhead

Conversation

@Agbasimere
Copy link
Copy Markdown
Contributor

Closes: #1021

Description

This PR addresses the performance tracking of the Soroban simulator's snapshot mechanism. It introduces a comprehensive benchmark to ensure that loading ledger snapshots (which populate the Host storage) does not degrade core simulation performance beyond acceptable limits.

Key Changes

  • Benchmark Suite: Added simulator/benches/snapshot_bench.rs using criterion.
  • Performance Measurement:
    • Compares execution time of a baseline Host (no snapshots) against a Host populated with 1,000 ledger entries.
    • Measures the cost of 1,000 host function calls to detect any regression in core simulation logic.
  • Reporting: Configured criterion with csv_output for tracking results over time.
  • CI Integration: Updated .github/workflows/ci.yml to run cargo bench -- --test to prevent regressions during the build process.
  • Crate Visibility: Made runner public in lib.rs to allow the benchmark harness to initialize the simulation environment.

Acceptance Criteria

  • Benchmarks added in simulator/benches/snapshot_bench.rs.
  • Comparison of 1,000 host functions with vs without snapshots.
  • Results exportable to CSV.
  • Automated run in CI.

File Changes

  • simulator/Cargo.toml: Added criterion and [[bench]] section.
  • simulator/benches/snapshot_bench.rs: Native Rust performance benchmark implementation.
  • simulator/src/lib.rs: Exposed runner module for benchmarking.
  • .github/workflows/ci.yml: Added benchmark verification step.

Testing

Ran baseline benchmark locally:

cd simulator
cargo bench --bench snapshot_bench

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 27, 2026

@Agbasimere Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@dotandev
Copy link
Copy Markdown
Owner

fix ci and conflicts.

@Agbasimere Agbasimere force-pushed the perf/snapshot-bench-overhead branch from c7cd02b to fd9af0f Compare March 27, 2026 20:38
@Agbasimere
Copy link
Copy Markdown
Contributor Author

@dotandev All checks passed, Kindly merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TIME-TRAVEL] [TEST] Performance benchmark: Snapshot overhead

2 participants