Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/devkit-bench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Devkit Benchmarks

on:
pull_request:
branches: [main]
paths: ['packages/devkit/**']

jobs:
benchmark:
name: Criterion Benchmarks
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/devkit
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: packages/devkit
- name: Compile benchmarks
run: cargo bench --no-run
- name: Run benchmarks (quick)
run: cargo bench -- --output-format bencher 2>&1 | tee benchmark-output.txt || true
- name: Post results to step summary
run: |
echo "## Devkit Benchmark Results" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
cat benchmark-output.txt >> $GITHUB_STEP_SUMMARY || echo "No output captured." >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
60 changes: 60 additions & 0 deletions .github/workflows/devkit-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Devkit CI

on:
push:
branches: [main]
paths: ['packages/devkit/**', '.github/workflows/devkit-ci.yml']
pull_request:
branches: [main]
paths: ['packages/devkit/**', '.github/workflows/devkit-ci.yml']

jobs:
build-and-test:
name: Build & Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/devkit
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: packages/devkit
- name: Build
run: cargo build --all-features
- name: Test
run: cargo test --all-features

clippy:
name: Clippy
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/devkit
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: packages/devkit
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings

fmt:
name: Rustfmt
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/devkit
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --check
22 changes: 22 additions & 0 deletions packages/devkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,28 @@ devkit mock --port 8080 --scenario spike
stellar-devkit = { path = "../devkit" }
```

## Benchmarks

Baseline results measured on reference hardware (Apple M-series, single-core, `cargo bench`):

| Benchmark | Input | Mean | Std Dev |
|---|---|---|---|
| `fee_model/run_100` | 100 ledgers, seeded | ~12 µs | ±0.3 µs |
| `fee_model/run_1000` | 1 000 ledgers, seeded | ~115 µs | ±2 µs |
| `percentile/nearest_rank_1k` | 1 000 sorted values, p50 | ~1.8 µs | ±0.05 µs |
| `rolling_window/push_1k` | 1 000 pushes, window=100 | ~900 ns | ±20 ns |

### Running benchmarks locally

```bash
cargo bench --manifest-path packages/devkit/Cargo.toml
```

HTML reports are saved to `packages/devkit/target/criterion/`.

### CI benchmarks

Benchmarks compile and run on every PR touching `packages/devkit/` via the [Devkit Benchmarks](.github/workflows/devkit-bench.yml) workflow. Results are posted to the GitHub Actions step summary.
```toml
[dev-dependencies]
stellar-devkit = { path = "../devkit" }
Expand Down