-
Notifications
You must be signed in to change notification settings - Fork 398
Benchmark mock contract sizes #1471
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces tooling to benchmark and track Cairo contract bytecode and class sizes.
- Adds
benchmark_diff.pyto compare current and previous benchmarks with CLI color diff and markdown table outputs. - Adds
benchmark.pyto generate size metrics (felts and bytes) as JSON or formatted CLI output. - Updates
Scarb.tomland CI workflows to build contracts, record baseline sizes, and post diffs on pull requests.
Reviewed Changes
Copilot reviewed 6 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/benchmark_diff.py | New script for diffing benchmark outputs and printing colored/markdown summaries |
| scripts/benchmark.py | New script for collecting contract size metrics |
| packages/test_common/Scarb.toml | Enabled CASM compilation for benchmarking |
| benches/contract_sizes.json | Initialized empty baseline for contract sizes |
| .github/workflows/benches/update-benches.yml | Workflow to update baseline benchmarks after merges |
| .github/workflows/benches/show-diff.yml | Workflow to comment benchmark diffs on new or updated PRs |
| TARGET_DIR = "target/release" | ||
|
|
||
|
|
||
| def try_get_name(filename): |
Copilot
AI
Jul 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The try_get_name function is duplicated in benchmark_diff.py; consider extracting it to a shared utility module to avoid code duplication.
🧪 Cairo Contract Size Benchmark Diff🧪 BYTECODE SIZE (felts)
🧪 SIERRA CONTRACT CLASS SIZE (bytes)
This comment was generated automatically from benchmark diffs. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1471 +/- ##
=======================================
Coverage 92.40% 92.40%
=======================================
Files 82 82
Lines 2265 2265
=======================================
Hits 2093 2093
Misses 172 172 Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
immrsd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, just left a couple of minor suggestions
immrsd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job, LGTM!
Fixes #1470