Skip to content

fix(benches): forge build benches #11036

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 14 commits into from
Jul 24, 2025
Merged

fix(benches): forge build benches #11036

merged 14 commits into from
Jul 24, 2025

Conversation

yash-atreya
Copy link
Member

@yash-atreya yash-atreya commented Jul 18, 2025

Motivation

  • Benchmarks being run in parallel were leading to incorrect results - fix for this is addressed in fix(benches): bench sequentially #11032.
  • Forge build with cache benchmarks were incorrect as we were not preparing the cache.

Solution

  • Fix: Prepares the cache for each timed run in forge_build_with_cache bench + Cleans the cache after each timed run for forge_build_no_cache
  • Disable linting for forge build benches
  • Runs the latest benchmarks (results in benches/LATEST.md) across:
  1. Versions: v1.2.3 (stable), nighly-0591876 (revm 24), nightly-0af43412 revm 27
  2. Repos: ithacaxyz/account, Vectorized/solady, Uniswap/v4-core, sparkdotfi/spark-psm
The benchmarks were run sequentially using this script (which won't be needed after #11032)
# Forge versions |stable | revm-24 nightly | revm-27 nightly
export VERSIONS="v1.2.3,nightly-05918765cb239024e9ca396825abb9f46257419a,nightly-0af43412f809c998d8b2fe69a1c9a789b7ebd085" \

# Repositories

export ITHACA_ACCOUNT="ithacaxyz/account:v0.3.2" \

export SOLADY_REPO="Vectorized/solady:v0.1.22" \

export UNISWAP_V4_CORE="Uniswap/v4-core:59d3ecf" \

export SPARK_PSM="sparkdotfi/spark-psm:v1.0.0" \

# Benches 

export TEST="forge_test" \

export FUZZ_TEST="forge_fuzz_test" \

export BUILD="forge_build_no_cache" \

export BUILD_CACHE="forge_build_with_cache" \

export COVERAGE="forge_coverage" \

# Results Dir

export TEST_RESUTLS_DIR="./benches/results/test" \

export BUILD_RESULTS_DIR="./benches/results/build" \

export COVERAGE_RESULTS_DIR="./benches/results/coverage" \

# Bench every repo in isolation for each command to get the true performance.

# Forge Tests

echo "================== Forge Tests ==================" && \

foundry-bench --versions "$VERSIONS" --repos "$ITHACA_ACCOUNT" --benchmarks $TEST --output-dir $TEST_RESUTLS_DIR --output-file ITHACA_ACCOUNT.md && \
foundry-bench --versions "$VERSIONS" --repos "$SOLADY_REPO" --benchmarks $TEST --output-dir $TEST_RESUTLS_DIR --output-file SOLADY.md && \
foundry-bench --versions "$VERSIONS" --repos "$UNISWAP_V4_CORE" --benchmarks $TEST --output-dir $TEST_RESUTLS_DIR --output-file UNISWAP_V4_CORE.md && \
foundry-bench --versions "$VERSIONS" --repos "$SPARK_PSM" --benchmarks $TEST --output-dir $TEST_RESUTLS_DIR --output-file SPARK_PSM.md && \

# Forge Fuzz Tests

echo "================== Forge Fuzz Tests ==================" && \

foundry-bench --versions "$VERSIONS" --repos "$ITHACA_ACCOUNT" --benchmarks $FUZZ_TEST --output-dir $TEST_RESUTLS_DIR --output-file ITHACA_ACCOUNT_fuzz.md && \
foundry-bench --versions "$VERSIONS" --repos "$SOLADY_REPO" --benchmarks $FUZZ_TEST --output-dir $TEST_RESUTLS_DIR --output-file SOLADY_fuzz.md && \
foundry-bench --versions "$VERSIONS" --repos "$UNISWAP_V4_CORE" --benchmarks $FUZZ_TEST --output-dir $TEST_RESUTLS_DIR --output-file UNISWAP_V4_CORE_fuzz.md && \
foundry-bench --versions "$VERSIONS" --repos "$SPARK_PSM" --benchmarks $FUZZ_TEST --output-dir $TEST_RESUTLS_DIR --output-file SPARK_PSM_fuzz.md && \

# Forge Build

echo "================== Forge Build ==================" && \

foundry-bench --versions "$VERSIONS" --repos "$ITHACA_ACCOUNT" --benchmarks $BUILD --output-dir $BUILD_RESULTS_DIR --output-file ITHACA_ACCOUNT.md && \
foundry-bench --versions "$VERSIONS" --repos "$SOLADY_REPO" --benchmarks $BUILD --output-dir $BUILD_RESULTS_DIR --output-file SOLADY.md && \
foundry-bench --versions "$VERSIONS" --repos "$UNISWAP_V4_CORE" --benchmarks $BUILD --output-dir $BUILD_RESULTS_DIR --output-file UNISWAP_V4_CORE.md && \
foundry-bench --versions "$VERSIONS" --repos "$SPARK_PSM" --benchmarks $BUILD --output-dir $BUILD_RESULTS_DIR --output-file SPARK_PSM.md && \

# Forge Build with Cache

echo "================== Forge Build with Cache ==================" && \

foundry-bench --versions "$VERSIONS" --repos "$ITHACA_ACCOUNT" --benchmarks $BUILD_CACHE --output-dir $BUILD_RESULTS_DIR --output-file ITHACA_ACCOUNT_cache.md && \
foundry-bench --versions "$VERSIONS" --repos "$SOLADY_REPO" --benchmarks $BUILD_CACHE --output-dir $BUILD_RESULTS_DIR --output-file SOLADY_cache.md && \
foundry-bench --versions "$VERSIONS" --repos "$UNISWAP_V4_CORE" --benchmarks $BUILD_CACHE --output-dir $BUILD_RESULTS_DIR --output-file UNISWAP_V4_CORE_cache.md && \
foundry-bench --versions "$VERSIONS" --repos "$SPARK_PSM" --benchmarks $BUILD_CACHE --output-dir $BUILD_RESULTS_DIR --output-file SPARK_PSM_cache.md && \

# Coverage

echo "================== Forge Coverage ==================" && \

foundry-bench --versions "$VERSIONS" --repos "$ITHACA_ACCOUNT" --benchmarks $COVERAGE --output-dir $COVERAGE_RESULTS_DIR --output-file ITHACA_ACCOUNT.md && \
foundry-bench --versions "$VERSIONS" --repos "$UNISWAP_V4_CORE" --benchmarks $COVERAGE --output-dir $COVERAGE_RESULTS_DIR --output-file UNISWAP_V4_CORE.md && \
foundry-bench --versions "$VERSIONS" --repos "$SPARK_PSM" --benchmarks $COVERAGE --output-dir $COVERAGE_RESULTS_DIR --output-file SPARK_PSM.md && \

echo "================== Forge Benchmarks Completed =================="

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@yash-atreya yash-atreya marked this pull request as ready for review July 18, 2025 06:33
zerosnacks
zerosnacks previously approved these changes Jul 18, 2025
@yash-atreya yash-atreya self-assigned this Jul 22, 2025
@yash-atreya yash-atreya moved this to Ready For Review in Foundry Jul 22, 2025
@yash-atreya yash-atreya changed the title fix(benches): forge build benches + run LATEST fix(benches): forge build benches Jul 24, 2025
grandizzy
grandizzy previously approved these changes Jul 24, 2025
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@yash-atreya yash-atreya merged commit a616c7a into master Jul 24, 2025
22 checks passed
@github-project-automation github-project-automation bot moved this from Ready For Review to Done in Foundry Jul 24, 2025
@yash-atreya yash-atreya deleted the v1.3.0-benches branch July 24, 2025 07:48
@grandizzy grandizzy moved this from Done to Completed in Foundry Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

3 participants