benches/README.md
This directory contains performance benchmarks for Foundry commands across multiple repositories and Foundry versions.
Before running the benchmarks, ensure you have the following installed:
Rust and Cargo - Required for building the benchmark binary
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Foundryup - The Foundry toolchain installer
curl -L https://foundry.paradigm.xyz | bash
foundryup
Git - For cloning benchmark repositories
Hyperfine - The benchmarking tool used by foundry-bench
Node.js and npm - Some repositories require npm dependencies
Build and install the benchmark runner:
cargo build --release --bin foundry-bench
To install foundry-bench to your PATH:
cd benches && cargo install --path . --bin foundry-bench
# Run all benchmarks on default repos with stable and nightly versions
foundry-bench --versions stable,nightly
# Bench specific versions
foundry-bench --versions stable,nightly,v1.0.0
# Run on specific repositories. Default rev for the repo is "main"
foundry-bench --repos ithacaxyz/account,Vectorized/solady
# Test specific repository with custom revision
foundry-bench --repos ithacaxyz/account:main,Vectorized/solady:v0.0.123
# Run only specific benchmarks
foundry-bench --benchmarks forge_build_with_cache,forge_test
# Run only fuzz tests
foundry-bench --benchmarks forge_fuzz_test
# Run coverage benchmark
foundry-bench --benchmarks forge_coverage
# Combine options
foundry-bench \
--versions stable,nightly \
--repos ithacaxyz/account \
--benchmarks forge_build_with_cache
# Force install Foundry versions
foundry-bench --force-install
# Verbose output to see hyperfine logs
foundry-bench --verbose
# Output to specific directory
foundry-bench --output-dir ./results --output-file LATEST_RESULTS.md
--versions <VERSIONS> - Comma-separated list of Foundry versions (default: stable,nightly)--repos <REPOS> - Comma-separated list of repos in org/repo[:rev] format (default: ithacaxyz/account:v0.3.2,Vectorized/solady:v0.1.22)--benchmarks <BENCHMARKS> - Comma-separated list of benchmarks to run--force-install - Force installation of Foundry versions--verbose - Show detailed benchmark output--output-dir <DIR> - Directory for output files (default: benches)--output-file <FILE_NAME.md> - Name of the output file (default: LATEST.md)forge_test - Benchmarks forge test command across reposforge_build_no_cache - Benchmarks forge build with clean cacheforge_build_with_cache - Benchmarks forge build with existing cacheforge_fuzz_test - Benchmarks forge test with only fuzz tests (tests with parameters)forge_coverage - Benchmarks forge coverage --ir-minimum command across reposThe benchmark binary uses command-line arguments to configure which repositories and versions to test. The default repositories are:
ithacaxyz/account:v0.3.2Vectorized/solady:v0.1.22You can override these using the --repos flag with the format org/repo[:rev].
Benchmark results are saved to benches/LATEST.md (or custom output file specified with --output-file). The report includes:
--force-install flag or manually install with foundryup --install <version>