-
Notifications
You must be signed in to change notification settings - Fork 1
ci: unified benchmark suite with full baselines and regression gate #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5eef897
ci: unified benchmark suite with full baselines and regression gate
clean6378-max-it fcda8ed
fix(bench): address review feedback and seed ubuntu baselines
clean6378-max-it 87a747c
fix(bench): gate all baseline benchmarks and validate finite ratios
clean6378-max-it 29ad5a7
fix(bench): harden reduce_baselines and fix Python 3.10 CI
clean6378-max-it c5c2066
fix(bench): address bradjin8 review on search, cache, and baselines
clean6378-max-it 5a51d70
chore(bench): refresh baselines from ubuntu CI run 28206463463
clean6378-max-it 6fed47e
bench: exclude round_trip from gate; refresh baselines from latest CI
clean6378-max-it File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,3 +46,4 @@ coverage.xml | |
| .hypothesis/ | ||
| benchmark-results.json | ||
| benchmarks/_raw.json | ||
| benchmarks/_ci/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| .PHONY: seed-baselines-local update-baselines check-benchmarks clean-benchmark-artifacts | ||
|
|
||
| # WARNING: captures timings on THIS machine. Production baselines must match ubuntu-latest CI. | ||
| # Prefer downloading benchmark-results.json from a CI artifact, then: | ||
| # python scripts/reduce_baselines.py benchmark-results.json benchmarks/baselines.json --slack 1.5 | ||
| seed-baselines-local: | ||
| @echo "WARNING: seed-baselines-local uses this host's timings; CI gates on ubuntu-latest." >&2 | ||
| python -m pytest tests/benchmarks/ --benchmark-only --benchmark-json=benchmarks/_raw.json -o addopts= | ||
| python scripts/reduce_baselines.py benchmarks/_raw.json benchmarks/baselines.json --slack 1.5 --source local | ||
|
|
||
| # Deprecated alias — kept for muscle memory; see seed-baselines-local warning above. | ||
| update-baselines: seed-baselines-local | ||
|
|
||
| check-benchmarks: | ||
| python -m pytest tests/benchmarks/ --benchmark-only --benchmark-json=benchmark-results.json -o addopts= | ||
| python scripts/check_benchmark_regression.py benchmark-results.json benchmarks/baselines.json | ||
|
|
||
| clean-benchmark-artifacts: | ||
| python -c "import pathlib; [p.unlink(missing_ok=True) for p in (pathlib.Path('benchmarks/_raw.json'), pathlib.Path('benchmark-results.json'))]" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Performance benchmarks | ||
|
|
||
| Test files live under `tests/benchmarks/`; this directory holds documentation and `baselines.json` for the CI regression gate. | ||
|
|
||
| Repeatable local measurements for workspace listing, export, search, and summary-cache hot paths. | ||
|
|
||
| ## Run locally | ||
|
|
||
| ```bash | ||
| pip install -r requirements-lock.txt | ||
| pip install 'pytest>=8,<9' 'pytest-benchmark==4.0.0' | ||
| pytest tests/benchmarks/ --benchmark-only -o addopts= -v | ||
| ``` | ||
|
|
||
| ## Scenarios | ||
|
|
||
| | Group | What | | ||
| |-------|------| | ||
| | parse | `list_workspace_projects(..., nocache=True)` over 10 / 50 / 200 synthetic composers | | ||
| | export | `POST /api/export` (ZIP) over 10 / 50 composer corpora | | ||
| | search | `GET /api/search` over a 50-composer synthetic corpus | | ||
| | summary-cache | cache lookup (hit/miss), fingerprint (10/50/200), round-trip, tab-summary lookup | | ||
|
|
||
| Synthetic corpora are built in `tests/benchmarks/conftest.py` — no real Cursor storage dependency. | ||
|
|
||
| ## CI gate | ||
|
|
||
| The `benchmarks` job on **ubuntu-latest** runs the full `tests/benchmarks/` suite (`--benchmark-json=benchmark-results.json`), then `scripts/check_benchmark_regression.py benchmark-results.json benchmarks/baselines.json`. | ||
|
|
||
| - **Fail** when a gated mean exceeds its baseline by **>20%** | ||
| - **Fail** when a gated mean is **<50%** of baseline (stale — refresh after intentional speedups) | ||
| - **Fail** when a gated baseline name has no current result | ||
| - **Warn** for benchmarks without a baseline entry | ||
| - All benchmarks listed in `baselines.json` are gated (no exclusion list) | ||
|
|
||
| Pinned runner: `ubuntu-latest`, `--benchmark-min-rounds=5`. | ||
|
|
||
| ## Refresh baselines | ||
|
|
||
| After intentional performance work, capture on **ubuntu-latest** (same OS as the gated CI job). Download `benchmark-results.json` from a CI artifact when possible: | ||
|
|
||
| ```bash | ||
| python scripts/reduce_baselines.py benchmark-results.json benchmarks/baselines.json --slack 1.5 | ||
| ``` | ||
|
|
||
| For a quick local snapshot only (may not match CI timings): | ||
|
|
||
| ```bash | ||
| make seed-baselines-local | ||
| ``` | ||
|
|
||
| `make update-baselines` is a deprecated alias for `seed-baselines-local`. Do not commit baselines from macOS/Windows unless you accept cross-OS gate skew. | ||
|
|
||
| ## Makefile targets | ||
|
|
||
| | Target | Purpose | | ||
| |--------|---------| | ||
| | `make check-benchmarks` | Run suite + regression gate locally | | ||
| | `make seed-baselines-local` | Capture local timings into `benchmarks/baselines.json` (with slack) | | ||
| | `make clean-benchmark-artifacts` | Remove `benchmark-results.json` and `benchmarks/_raw.json` | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,29 @@ | ||
| { | ||
| "_note": "Gated means from ubuntu-latest CI benchmark-results.json (PR #120, run 28123677675). Refresh after intentional perf changes: download benchmark-results.json from the CI artifacts job, then `python scripts/check_benchmark_regression.py benchmark-results.json benchmarks/baselines.json` (re-seed with reduce_baselines or edit means). Local capture: `pytest tests/benchmarks/ --benchmark-only --benchmark-json=benchmark-results.json -o addopts=` on ubuntu-latest.", | ||
| "updated": "2026-06-24T19:20:27Z", | ||
| "_note": "Gated means from ubuntu-latest CI benchmark-results.json. Values multiplied by 1.5x slack at generation time. Refresh after intentional speedups via reduce_baselines.py.", | ||
| "updated": "2026-06-25T21:48:35Z", | ||
| "machine": "Linux", | ||
| "groups": { | ||
| "parse": { | ||
| "test_list_workspace_projects_nocache[composers-10]": 0.01702312019643009, | ||
| "test_list_workspace_projects_nocache[composers-50]": 0.07538331990000699, | ||
| "test_list_workspace_projects_nocache[composers-200]": 0.251991555999993 | ||
| }, | ||
| "export": { | ||
| "test_post_export_zip[composers-10]": 0.0112034034344294, | ||
| "test_post_export_zip[composers-50]": 0.04482855966665985 | ||
| }, | ||
| "search": { | ||
| "test_search_full_corpus": 0.047164217833331655 | ||
| }, | ||
| "summary-cache": { | ||
| "test_summary_cache_hit": 6.3e-05, | ||
| "test_summary_cache_miss": 6.3e-05, | ||
| "test_fingerprint_workspace_entries[10]": 0.001844, | ||
| "test_fingerprint_workspace_entries[50]": 0.007759, | ||
| "test_fingerprint_workspace_entries[200]": 0.022231, | ||
| "test_summary_cache_round_trip": 0.000351 | ||
| "test_summary_cache_lookup[hit]": 9.224067718099102e-05, | ||
| "test_summary_cache_lookup[miss]": 9.128770315496628e-05, | ||
|
bradjin8 marked this conversation as resolved.
Outdated
|
||
| "test_fingerprint_workspace_entries[10]": 0.0024789120309553535, | ||
| "test_fingerprint_workspace_entries[50]": 0.010901568931818675, | ||
| "test_fingerprint_workspace_entries[200]": 0.03069810573000666, | ||
| "test_summary_cache_round_trip": 0.0004966099535917549, | ||
| "test_tab_summary_cache_lookup[hit]": 0.00010487297799045405, | ||
| "test_tab_summary_cache_lookup[miss]": 0.00010309520517204601 | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.