-
Notifications
You must be signed in to change notification settings - Fork 2k
feat: benchmark suite #10804
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
base: master
Are you sure you want to change the base?
feat: benchmark suite #10804
Conversation
- Automated benchmarking across multiple Foundry versions using hyperfine - Supports stable, nightly, and specific version tags (e.g., v1.0.0) - Benchmarks 5 major Foundry projects: account, v4-core, solady, morpho-blue, spark-psm - Tests forge test, forge build (no cache), and forge build (with cache) - Generates comparison tables in markdown format - Uses foundryup for version management - Exports JSON data for detailed analysis 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Fix relative path issue causing JSON files to fail creation - Convert benchmark directories to absolute paths using SCRIPT_DIR - Improve markdown table formatting with proper column names and alignment - Use unified table generation with string concatenation for better formatting - Increase benchmark runs from 3 to 5 for more reliable results - Use --prepare instead of --cleanup for better cache management - Remove stderr suppression to catch hyperfine errors - Update table headers to show units (seconds) for clarity 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
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.
i think that the only "must" is support for env vars, the rest are nice-to-have features
- run forge build in parallet for forge-test bench - switch foundry versions - README specifying prereqs
- Add `get_benchmark_versions()` helper to read versions from env var - Update all benchmarks to use version helper for consistency - Add `--versions` and `--force-install` flags to shell script - Enable all three benchmarks (forge_test, build_no_cache, build_with_cache) - Improve error handling for corrupted forge installations - Remove complex workarounds in favor of clear error messages The benchmarks now support custom versions via: ./run_benchmarks.sh --versions stable,nightly,v1.2.0 🤖 Generated with Claude Code Co-Authored-By: Claude <[email protected]>
* feat: criterion benches * - setup benchmark repos in parallel - run forge build in parallet for forge-test bench - switch foundry versions - README specifying prereqs * feat: shell script to run benches * feat: ci workflow, fix script * update readme * feat: enhance benchmarking suite with version flexibility - Add `get_benchmark_versions()` helper to read versions from env var - Update all benchmarks to use version helper for consistency - Add `--versions` and `--force-install` flags to shell script - Enable all three benchmarks (forge_test, build_no_cache, build_with_cache) - Improve error handling for corrupted forge installations - Remove complex workarounds in favor of clear error messages The benchmarks now support custom versions via: ./run_benchmarks.sh --versions stable,nightly,v1.2.0 🤖 Generated with Claude Code Co-Authored-By: Claude <[email protected]> * latest bench * rm notes * remove shell based bench suite --------- Co-authored-by: Claude <[email protected]>
* main.rs * forge version is controlled by the bin * parses criterion json to collect results - writes to LATEST.md
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.
looks like a great initial version to get the ball rolling!
for now i can't think of any more improvements than the listed ones in the follow-up section 👍
if: github.event.inputs.pr_number != '' | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | |
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.
can we move as much logic as possible away from the yaml file into separate files
jobs: | ||
forge-test: | ||
name: Run forge_test and forge_fuzz_test benchmarks | ||
runs-on: ubuntu-latest |
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.
we should not rely on github runners for accurate measurements
benches/FUZZ_BENCH.md
Outdated
| Repository | stable | nightly | | ||
| ----------------- | ------ | ------- | | ||
| ithacaxyz-account | 4.34 s | 3.69 s | | ||
| solady | 3.68 s | 2.92 s | |
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.
this is ok for now, but walltime is extremely unreliable and should not be the only metric we use
/// - "v0.2.0" - Specific version tag | ||
/// - "commit-hash" - Specific commit hash | ||
/// - "nightly-rev" - Nightly build with specific revision | ||
pub static FOUNDRY_VERSIONS: &[&str] = &["stable", "nightly"]; |
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.
these are the defaults correct?
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.
yeah
📊 Foundry Benchmark ResultsClick to view detailed benchmark resultsFoundry Benchmark ResultsGenerated at: 2025-07-04 08:09:08 UTC Date: 2025-07-04 08:08:57 SummaryBenchmarked 2 Foundry versions across 2 repositories. Repositories TestedFoundry Versions
Forge Fuzz Test
Forge Test
System Information
Date: 2025-07-04 08:02:32 SummaryBenchmarked 2 Foundry versions across 2 repositories. Repositories TestedFoundry Versions
Forge Build (With Cache)
Forge Build (No Cache)
System Information
Date: 2025-07-04 08:03:26 SummaryBenchmarked 2 Foundry versions across 1 repositories. Repositories TestedFoundry Versions
Forge Coverage
System Information
🤖 This comment was automatically generated by the Foundry Benchmarks workflow. To run benchmarks manually: Go to Actions → "Run workflow" |
Benchmarks ran in ci, but took super long and do not indicate accurate results. Probably because of github runner? @DaniPopes |
📊 Foundry Benchmark ResultsClick to view detailed benchmark resultsFoundry Benchmark ResultsGenerated at: 2025-07-04 10:01:09 UTC Date: 2025-07-04 10:00:55 SummaryBenchmarked 2 Foundry versions across 2 repositories. Repositories TestedFoundry Versions
Forge Fuzz Test
Forge Test
System Information
Date: 2025-07-04 09:54:36 SummaryBenchmarked 2 Foundry versions across 2 repositories. Repositories TestedFoundry Versions
Forge Build (No Cache)
Forge Build (With Cache)
System Information
Date: 2025-07-04 09:54:42 SummaryBenchmarked 2 Foundry versions across 1 repositories. Repositories TestedFoundry Versions
Forge Coverage
System Information
🤖 This comment was automatically generated by the Foundry Benchmarks workflow. To run benchmarks manually: Go to Actions → "Run workflow" |
Motivation
Closes #10548
Aggregated benchmark suite for testing performance of various commands such as test, build, coverage across multiple foundry versions and repositories.
Solution
/benches
bench/forge_test.rs
BenchmarkProject
is the utility type to clone various repos and run forge commands on themfoundry-bench
binary which is a CLI that has flags to specify--versions
,--repos
,--benchmarks
.BenchmarkResults
type aggregates the criterion results from thetarget/criterion/*
cache.benchmarks.yml
workflow that enables running benchmarks manuallyCurrently included
To be addressed in a followup
dynamic_test_linking
PR Checklist