Add automated benchmark regression check in CI (#144) - #147
Open
prajwal-tech07 wants to merge 1 commit into
Open
Add automated benchmark regression check in CI (#144)#147prajwal-tech07 wants to merge 1 commit into
prajwal-tech07 wants to merge 1 commit into
Conversation
Run the scaling benchmark on the PR and its base branch back-to-back on the same runner, swapping only the library under test (the src/ layout keeps the PR's benchmark harness fixed), and post a sticky pull-request comment with the relative runtime change per grid size. Compares relative (%) change rather than absolute seconds so per-runner noise largely cancels. Informational and non-blocking for now, with a low starting threshold to be calibrated against the runner's noise floor. - tests/benchmarks/compare.py: parse two --output-json files (schema from mllam#140), compute per-grid-size % deltas, render the markdown table, flag above a configurable threshold - tests/benchmarks/test_compare.py: unit tests for the comparison logic - .github/workflows/benchmark-regression.yml: same-runner A/B workflow, sticky comment via actions/github-script (job summary fallback for forks)
Collaborator
Author
|
Self-reviewed and ready for review ✅ This implements Phase 1 of #144 (automated benchmark regression check).
Notes:
No rush given the timeline — happy for this to wait for review. cc @yuvraajnarula (builds on your JSON output). |
leifdenby
reviewed
Aug 10, 2026
| # summary above. Never fail the job over the comment (informational). | ||
| if: github.event_name == 'pull_request' | ||
| continue-on-error: true | ||
| uses: actions/github-script@v7 |
Member
There was a problem hiding this comment.
I think we should use https://github.com/marocchino/sticky-pull-request-comment here instead
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Describe your changes
Adds an automated benchmark regression check in CI, implementing Phase 1 of #144.
On a pull request, the scaling benchmark is run on the PR and on its base branch back-to-back on the same runner, and a sticky PR comment reports the relative runtime change per grid size. Because both runs execute on the same VM and we compare relative (%) change rather than absolute seconds, the per-runner noise (which can be 20–50% across different GitHub-hosted runners) largely cancels.
How the harness is held constant: the benchmark script always comes from the PR checkout, and only the library under test is swapped between the two runs. The package uses a
src/layout, so the working tree never shadows the installed library - installing the base-branch build over the PR build cleanly swaps the code being measured while the ruler (the benchmark harness) stays fixed.Changes:
tests/benchmarks/compare.py- standard-library-only script that parses two--output-jsonfiles (schema introduced in feat: add memory profiling and JSON output to scaling benchmark #140:{grid_points, runtime_s, peak_memory_mb}), computes per-grid-size % deltas, renders the Markdown comparison table, and flags any grid size above a configurable threshold. Informational by default (--fail-on-regressionavailable for later).tests/benchmarks/test_compare.py- 17 unit tests covering the comparison logic (regression/improvement/threshold boundary, null memory, mismatched grid sizes, zero-baseline guard, malformed input, exit codes, output file)..github/workflows/benchmark-regression.yml- the same-runner A/B workflow. Usesuvfor env setup, swaps only the library viauv pip install --reinstall-package, runscompare.py, and posts/updates the sticky comment via first-partyactions/github-script(with a job-summary fallback so fork PRs still see results).Design notes / deliberate choices (per the discussion in #144):
pull_request_target, which would run untrusted PR code with a write token.Dependencies: no new runtime dependencies for the library. The workflow installs the package with its
visualisationextra (matplotlib, already an optional dependency) to run the benchmark.compare.pyis standard-library-only.Issue Link
Addresses #144 (Phase 1). Builds on the benchmark scripts from #117 and the JSON output from #140.
Type of change
Checklist before requesting a review
pullwith--rebaseoption if possible).Author checklist after completed review
reflecting type of change (add section where missing):