Skip to content

feat(bench): slang compile and test benchmark - #8692

Closed
nebasuke wants to merge 171 commits into
mainfrom
bas/slang-compile-benchmarks
Closed

nebasuke wants to merge 171 commits into
mainfrom
bas/slang-compile-benchmarks

Conversation

@nebasuke

@nebasuke nebasuke commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude summary

#8415's solx benchmark, replayed onto main, plus the slang compiler as a third compiler next to solc and solx 0.1.8: the same ten scenarios, cold-compile and Solidity-test cells, forge with solc and forge with solar as references, a workflow (ci:perf-slang) that stores its own slang baselines, and two renderers: the launch blog post's table shape, and a sticky PR comment that leads with the same tables plus solx 0.1.8 and forge + solar, then #8415's per-scenario detail. The numbers live in that comment; this description doesn't repeat them.

Replay of #8415

#8415's 111 commits are replayed in order (no squash). Two are dropped because main already has them: 9ff89ddc8 (main's in-process runner and shell.ts replace the hyperfine quoting fix) and 089630a8b (main has the same yarn hardened-mode fix). Where #8415's commits assumed hyperfine, the conflicts resolve to main's in-process runner (#8599), and the per-cell ignoreFailure plus keep-finished-entries change is ported onto runSeries/runPlain. #8415 merged main four times; those merges carried the plugin rename to hardhat-slang-solx across the scenario wrappers, which a linear replay drops, so d73f9080b restores every file #8415 created to its content at #8415's head. replay-standard-json.ts still calls hyperfine, which CI no longer installs; it is outside the slang workflow.

slang in the scenarios

  • hardhat-slang is registered in every wrapper config with a single slang profile: slang has one pipeline, neither legacy nor via-IR, so there is no via-IR twin and viaIR never reaches it (per-file via-IR overrides included).
  • The binary is the slang release pinned in pinned-tool-versions.sh (solx prerelease d95c1150, hardhat-slang's 0.1.0-pre.2026-10-29), downloaded and sha256-verified by provision-slang.ts and passed through hardhat-slang's path option. HARDHAT_SLANG_BENCH_BINARY substitutes a local build.
  • Every scenario has cold compile slang (plus OZ's forge-scope parity and lido-vaults' upgrade variants) and, where the suite runs under slang, warm test slang; lido-core also has cold test slang, like its other compilers.
  • Preinstall patches, each applied to every compiler and failing loudly if its anchor moves:
    • OZ keeps hardhat-exposed's AST pass on the default profile under slang: it reads solc's AST, which slang doesn't emit.
    • aave drops the one inline test config current Hardhat rejects (HHE821: invalid key "default.disable_block_gas_limit").
    • Solady's ERC6551Test#testExecute redraws its "unauthorized" caller while it equals the owner. TestPlus's PRNG hashes the free memory pointer, so its draws follow the compiler's memory layout, and under slang the draw was the owner.
    • 1inch-swap-vm's TWAPSwapTest#test_TWAP_CumulativeSoldTracking_Multiple_Swaps is taken out of discovery. Its expected amounts only hold when the compiler re-reads block.timestamp after vm.warp, as solc via-IR does; slang keeps the local, as the source says.
  • 1inch-swap-vm gains warm test cells for solc via-IR, slang and forge: its suite compiles at the 0.8.34 pin, and all three pass 705/705.

forge + solar

cold compile forge-1.8.5 solar runs in every scenario but lido-core (forge runs solar as its only compiler, and lido-core also compiles 0.4.24 and 0.6 sources). warm test forge-1.8.5 solar runs where the whole suite passes under solar: 1inch-aqua, ens, OpenZeppelin and Uniswap v4. The rest have tests that fail only under solar, whose code generation is experimental: graph-horizon (14), Solady (4) and aave (208), and on 1inch-swap-vm a 1000-round fee-tracking test that spends about 39% more gas than under solc and exceeds forge's per-test gas limit. The tables say so in place of a number.

Workflow and renderers

slang-regression-benchmark.yml runs on the self-hosted runner for PRs labelled ci:perf-slang, dispatches and main pushes, in two tiers:

  • PR and push runs measure only cold compile slang* and cold compile solx-0.1.8, 3 runs each (bench:regression --runs, new here), in about 35 minutes. Every other cell comes from the committed baseline, scripts/benchmark/slang-baseline-report.json, marked † with a link to the run that measured it.
  • Dispatches run the full matrix by default (cold compile*,warm test*, each cell's own runs) or the cells their filters select, and upload the baseline with their cells merged in (merge-baseline-report.ts, per cell) as the slang-baseline-report-merged artifact. Refreshing the baseline is copying that artifact over the committed file. The merge and the blog tables need the benchmark to succeed, unless allow-partial-baseline is set; strict-validation also makes them wait on the local-install check, which otherwise only warns. An unfiltered dispatch also uploads slang's standard-JSON inputs (bench:dump-standard-json --compiler slang) for replay without Hardhat.

Each run gets its own Yarn and Bun caches under RUNNER_TEMP and clears pnpm's metadata cache: the persistent runner otherwise served stale monorepo packages from Yarn's cached registry metadata, and pnpm failed tarball integrity checks against an earlier run's Verdaccio. Baselines go to the slang data dir with fail-on-alert off. A speedup within the two cells' run-to-run spread (floored at 0.1 s for single runs) reads as parity, since a fixed ratio band means little on a 1 s cell and a lot on a 100 s one. Every cell without a number carries its reason.

On dispatches, Store benchmark result fails on the enterprise's fine-grained PAT lifetime policy for BENCHMARK_GITHUB_TOKEN; the report, merged baseline and blog tables are still produced.

Known gaps

  • aave tests under slang: 149 of 1559 tests use vm.eip712HashStruct/vm.eip712HashType, whose type table Hardhat builds from the solc AST (solidity-test/eip712/); a slang build info has none. The slang test cell is left out until slang's output carries struct definitions and the collector reads them (debugSymbols lacks struct definitions, so Hardhat's EIP-712 cheatcodes fail under slang solx#813).
  • 1inch-swap-vm under solx 0.1.8: LLVM cannot stackify the recursive runLoop; slang compiles it.

@changeset-bot

changeset-bot Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4699c68

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

slang benchmarks

slang has a single pipeline, so its one cell is compared against both of solc's and solx's. Speedup = baseline wall / slang wall; "parity" means within run-to-run noise; generated from this run at 4699c68.

forge solar = forge 1.8.5 building with the solar its release ships: experimental codegen, one pipeline, lint-on-build off. Its test column is filled only where the whole Foundry suite passes under it.

slang vs solc --via-ir compilation

Building all 10 repos one after another takes solc 993s in total, and it takes slang 63s. A 15.6x overall improvement.

Repo Hardhat solc Hardhat solx-0.1.8 Hardhat slang vs Hardhat solc vs solx-0.1.8 forge solc vs forge solc forge solar
graph-horizon 279.7s† 23.3s† 3.5s‡ 79.3x† 6.6x† 273.9s† 77.6x† 1.6s†
1inch-swap-vm 262.9s† does not compile 4.1s‡ 63.9x† - 256.3s† 62.3x† 2.2s†
Uniswap v4 74.9s† 10.9s† 1.8s‡ 40.9x† 6.0x† 71.5s† 39.0x† 0.7s†
Solady 147.8s† 20.4s† 3.6s‡ 40.5x† 5.6x† 140.5s† 38.5x† 1.1s†
openzeppelin-contracts (entire repo) 144.7s† 24.2s† 5.7s‡ 25.5x† 4.3x† incompatible - incompatible
openzeppelin-contracts (forge-compatible subset) 46.3s† 10.7s† 2.1s‡ 22.2x† 5.1x† 42.5s† 20.4x† 0.8s†
Aave v4 13.1s† 3.6s† 1.2s‡ 11.0x† 3.0x† 9.1s† 7.6x† 0.2s†
1inch-aqua 8.4s† 3.4s† 0.9s‡ 9.0x† 3.6x† 6.7s† 7.2x† 0.2s†
lido-vaults 15.9s† 4.0s† 1.9s‡ 8.2x† 2.1x† 14.0s† 7.2x† 0.3s†
ens-verifiable-factory 5.3s† 3.0s† 0.9s‡ 5.9x† 3.4x† 3.6s† 4.1x† 0.2s†
lido-core 39.9s† 39.8s† 39.7s‡ parity† parity† 37.8s† 1.0x† n/a (0.4/0.6 sources)

slang vs solc in legacy mode (without --via-ir) compilation

Building all 7 repos one after another takes solc 154s in total, and it takes slang 18s. A 8.7x overall improvement.

Repo Hardhat solc Hardhat solx-0.1.8 Hardhat slang vs Hardhat solc vs solx-0.1.8 forge solc vs forge solc forge solar
graph-horizon 41.0s† 23.9s‡ 3.5s‡ 11.6x† 6.8x‡ 35.2s† 10.0x† 1.6s†
openzeppelin-contracts (entire repo) 53.9s† 23.5s‡ 5.7s‡ 9.5x† 4.1x‡ incompatible - incompatible
Uniswap v4 17.1s† 11.1s‡ 1.8s‡ 9.3x† 6.1x‡ 13.6s† 7.4x† 0.7s†
Solady 31.2s† 20.0s‡ 3.6s‡ 8.6x† 5.5x‡ 24.1s† 6.6x† 1.1s†
openzeppelin-contracts (forge-compatible subset) 17.6s† 10.4s† 2.1s‡ 8.4x† 5.0x† 13.8s† 6.6x† 0.8s†
1inch-aqua 3.6s† 3.3s‡ 0.9s‡ 3.8x† 3.6x‡ 1.9s† 2.1x† 0.2s†
Aave v4 4.1s† 2.7s‡ 1.2s‡ 3.4x† 2.2x‡ 3.0s† 2.5x† 0.2s†
ens-verifiable-factory 2.8s† 3.0s‡ 0.9s‡ 3.2x† 3.3x‡ 1.3s† 1.4x† 0.2s†

slang vs solc --via-ir including Solidity tests

Building all 8 repos one after another takes solc 1121s in total, and it takes slang 172s. A 6.5x overall improvement.

Repo Hardhat solc Hardhat solx-0.1.8 Hardhat slang vs Hardhat solc vs solx-0.1.8 forge solc vs forge solc forge solar
1inch-swap-vm 265.5s† does not compile 5.8s† 45.9x† - 258.2s† 44.7x† 1 test runs out of gas
graph-horizon 284.3s† 27.4s† 7.4s† 38.4x† 3.7x† 292.1s† 39.5x† 14 tests fail
Solady 149.7s† 22.3s† 5.3s† 28.2x† 4.2x† 141.5s† 26.7x† 4 tests fail
Uniswap v4 81.4s† 17.0s† 7.6s† 10.7x† 2.2x† 73.6s† 9.7x† 2.8s†
1inch-aqua 8.9s† 3.9s† 1.5s† 6.1x† 2.7x† 6.8s† 4.6x† 0.4s†
openzeppelin-contracts (entire repo) 181.6s† 57.6s† 38.6s† 4.7x† 1.5x† incompatible - incompatible
ens-verifiable-factory 5.8s† 3.6s† 1.5s† 4.0x† 2.5x† 3.8s† 2.6x† 0.3s†
openzeppelin-contracts (forge-compatible subset) 82.5s† 43.4s† 34.3s† 2.4x† 1.3x† 51.2s† 1.5x† 18.1s†
lido-core 143.7s† 106.3s† 104.5s† 1.4x† 1.0x† 157.5s† 1.5x† n/a (0.4/0.6 sources)
lido-vaults tests measured in lido-core tests measured in lido-core tests measured in lido-core - - tests measured in lido-core - tests measured in lido-core
Aave v4 tests do not compile 115.7s† not run (EIP-712 cheatcodes) - - tests do not compile - 208 tests fail

slang vs solc in legacy mode (without --via-ir) including Solidity tests

Building all 6 repos one after another takes solc 203s in total, and it takes slang 62s. A 3.3x overall improvement.

Repo Hardhat solc Hardhat solx-0.1.8 Hardhat slang vs Hardhat solc vs solx-0.1.8 forge solc vs forge solc forge solar
graph-horizon 46.0s† 27.8s† 7.4s† 6.2x† 3.8x† 53.2s† 7.2x† 14 tests fail
Solady 33.0s† 21.8s† 5.3s† 6.2x† 4.1x† 25.0s† 4.7x† 4 tests fail
Uniswap v4 24.1s† 17.2s† 7.6s† 3.2x† 2.3x† 15.7s† 2.1x† 2.8s†
1inch-aqua 4.1s† 3.9s† 1.5s† 2.8x† 2.6x† 2.0s† 1.4x† 0.4s†
openzeppelin-contracts (entire repo) 92.6s† 58.0s† 38.6s† 2.4x† 1.5x† incompatible - incompatible
ens-verifiable-factory 3.4s† 3.5s† 1.5s† 2.3x† 2.4x† 1.4s† parity† 0.3s†
openzeppelin-contracts (forge-compatible subset) 55.8s† 43.9s† 34.3s† 1.6x† 1.3x† 24.2s† 0.7x† 18.1s†
Aave v4 252.4s† 108.2s† not run (EIP-712 cheatcodes) - - 247.0s† - 208 tests fail

1inch-aqua-solx

cell wall s CPU s peak RSS MB runs slang speedup
cold compile forge-1.7.1 1.9† 2.5 214 5 2.1x†
cold compile forge-1.7.1 via-ir 6.7† 7.3 289 5 7.2x†
cold compile forge-1.8.5 solar 0.2† 0.9 77 5 0.3x†
cold compile slang 0.9‡ 2.4 391 3
cold compile solc 3.6† 3.9 347 5 3.8x†
cold compile solc no-opt 2.6† 2.9 351 5 2.8x†
cold compile solc via-ir 8.4† 8.7 411 5 9.0x†
cold compile solx-0.1.8 3.3‡ 5.6 485 3 3.6x‡
cold compile solx-0.1.8 via-ir 3.4† 5.8 414 5 3.6x†
warm test forge-1.7.1 0.1† 0.8 106 3 0.2x†
warm test forge-1.7.1 via-ir 0.1† 0.8 106 3 0.2x†
warm test forge-1.8.5 solar 0.1† 0.5 96 3 0.2x†
warm test slang 0.5† 0.8 245 3
warm test solc 0.6† 0.9 283 3 parity†
warm test solc via-ir 0.6† 0.9 277 3 parity†
warm test solx-0.1.8 0.6† 0.9 282 3 parity†
warm test solx-0.1.8 via-ir 0.6† 0.9 269 3 parity†

1inch-swap-vm-solx

cell wall s CPU s peak RSS MB runs slang speedup
cold compile forge-1.7.1 via-ir 256.3† 256.6 3413 5 62.3x†
cold compile forge-1.8.5 solar 2.2† 11.3 178 5 0.5x†
cold compile slang 4.1‡ 98.3 1942 3
cold compile solc via-ir 262.9† 264.0 3931 5 63.9x†
warm test forge-1.7.1 via-ir 1.9† 10.9 378 3 1.1x†
warm test slang 1.7† 5.8 957 3
warm test solc via-ir 2.6† 10.9 1152 3 1.6x†
cold compile solc n/a³
cold compile solx-0.1.8 n/a³
cold compile solx-0.1.8 via-ir ✗ does not compile¹
warm test forge-1.8.5 solar ✗ 1 test runs out of gas⁷

aave-v4-solx

cell wall s CPU s peak RSS MB runs slang speedup
cold test forge-1.7.1 247.0† 4366.6 4516 1
cold test solc 252.4† 2910.5 5666 1
cold test solx-0.1.8 108.2† 2562.7 13936 1
cold test solx-0.1.8 via-ir 115.7† 2669.5 8416 1
cold compile forge-1.7.1 3.0† 7.2 129 5 2.5x†
cold compile forge-1.7.1 via-ir 9.1† 13.3 219 5 7.6x†
cold compile forge-1.8.5 solar 0.2† 1.2 86 5 0.2x†
cold compile slang 1.2‡ 5.3 424 3
cold compile solc 4.1† 9.0 219 5 3.4x†
cold compile solc no-opt 3.8† 7.0 240 5 3.1x†
cold compile solc via-ir 13.1† 13.5 334 5 11.0x†
cold compile solx-0.1.8 2.7‡ 9.7 373 3 2.2x‡
cold compile solx-0.1.8 via-ir 3.6† 8.2 375 5 3.0x†
warm test forge-1.7.1 66.2† 4130.9 1451 1
warm test solc 64.8† 2680.1 3089 1
warm test solx-0.1.8 46.8† 1997.3 1988 1
warm test solx-0.1.8 via-ir 45.7† 2040.1 2235 1
warm test slang not run⁴
warm test solc via-ir ✗ tests do not compile⁵
warm test forge-1.8.5 solar ✗ 208 tests fail⁷

ens-verifiable-factory-solx

cell wall s CPU s peak RSS MB runs slang speedup
cold compile forge-1.7.1 1.3† 1.5 186 5 1.4x†
cold compile forge-1.7.1 via-ir 3.6† 3.9 243 5 4.1x†
cold compile forge-1.8.5 solar 0.2† 0.5 71 5 0.2x†
cold compile slang 0.9‡ 2.0 373 3
cold compile solc 2.8† 3.1 317 5 3.2x†
cold compile solc no-opt 2.3† 2.6 318 5 2.6x†
cold compile solc via-ir 5.3† 5.6 357 5 5.9x†
cold compile solx-0.1.8 3.0‡ 4.6 400 3 3.3x‡
cold compile solx-0.1.8 via-ir 3.0† 4.7 382 5 3.4x†
warm test forge-1.7.1 0.1† 0.4 94 3 0.2x†
warm test forge-1.7.1 via-ir 0.1† 0.4 94 3 0.2x†
warm test forge-1.8.5 solar 0.1† 0.4 88 3 0.2x†
warm test slang 0.6† 0.8 191 3
warm test solc 0.6† 0.8 220 3 parity†
warm test solc via-ir 0.6† 0.8 223 3 parity†
warm test solx-0.1.8 0.6† 0.8 221 3 parity†
warm test solx-0.1.8 via-ir 0.6† 0.8 221 3 parity†

graph-horizon-solx

cell wall s CPU s peak RSS MB runs slang speedup
cold compile forge-1.7.1 35.2† 35.5 1199 5 10.0x†
cold compile forge-1.7.1 via-ir 273.9† 274.2 4116 5 77.6x†
cold compile forge-1.8.5 solar 1.6† 9.4 309 5 0.5x†
cold compile slang 3.5‡ 55.2 1445 3
cold compile solc 41.0† 42.1 1644 5 11.6x†
cold compile solc no-opt 15.1† 16.3 2030 5 4.3x†
cold compile solc via-ir 279.7† 281.0 4547 5 79.3x†
cold compile solx-0.1.8 23.9‡ 201.1 6717 3 6.8x‡
cold compile solx-0.1.8 via-ir 23.3† 135.5 3064 5 6.6x†
warm test forge-1.7.1 18.0† 953.9 735 3 4.6x†
warm test forge-1.7.1 via-ir 18.2† 940.3 757 3 4.7x†
warm test slang 3.9† 70.4 1234 3
warm test solc 5.0† 103.2 1406 3 1.3x†
warm test solc via-ir 4.6† 98.4 1362 3 1.2x†
warm test solx-0.1.8 4.0† 75.9 1292 3 parity†
warm test solx-0.1.8 via-ir 4.1† 75.9 1328 3 parity†
warm test forge-1.8.5 solar ✗ 14 tests fail⁷

lidofinance-core-solx

cell wall s CPU s peak RSS MB runs slang speedup
cold test forge-1.7.1 via-ir 157.5† 1482.1 681 1
cold test slang 104.5† 1139.7 1591 1
cold test solc via-ir 143.7† 1372.9 1678 1
cold test solx-0.1.8 via-ir 106.3† 1190.7 1712 1
cold compile forge-1.7.1 via-ir 37.8† 59.3 275 5 1.0x†
cold compile slang 39.7‡ 54.6 580 3
cold compile solc via-ir 39.9† 68.2 407 5 parity†
cold compile solx-0.1.8 via-ir 39.8† 59.9 442 5 parity†
warm test forge-1.7.1 via-ir 122.6† 1408.4 668 1 1.9x†
warm test slang 65.2† 1061.4 1551 1
warm test solc via-ir 90.1† 1261.4 1562 1 1.4x†
warm test solx-0.1.8 via-ir 66.4† 1104.7 1583 1 1.0x†
cold compile solc n/a³
cold compile solx-0.1.8 n/a³
warm test solc n/a³
warm test solx-0.1.8 n/a³
cold compile forge-1.8.5 solar n/a⁶

lidofinance-vaults-solx

cell wall s CPU s peak RSS MB runs slang speedup
cold compile forge-1.7.1 via-ir 14.0† 14.5 272 5 7.2x†
cold compile forge-1.8.5 solar 0.3† 1.5 81 5 0.2x†
cold compile slang 1.9‡ 7.0 542 3
cold compile slang upgrade 1.4‡ 2.6 294 3
cold compile solc via-ir 15.9† 20.3 336 5 8.2x†
cold compile solx-0.1.8 via-ir 4.0† 12.0 384 5 2.1x†
cold compile solx-0.1.8 via-ir upgrade 2.1† 3.5 271 5 1.5x†
cold compile solc n/a³
cold compile solx-0.1.8 n/a³
cold compile solc via-ir upgrade ✗ does not compile²

openzeppelin-contracts-0.34

cell wall s CPU s peak RSS MB runs slang speedup
cold compile forge-1.7.1 13.8† 14.2 790 5 6.6x†
cold compile forge-1.7.1 via-ir 42.5† 42.8 1189 5 20.4x†
cold compile forge-1.8.5 solar 0.8† 3.1 151 5 0.4x†
cold compile slang 5.7‡ 51.6 1158 3
cold compile slang parity 2.1‡ 15.4 806 3
cold compile solc 53.9† 55.3 2015 5 9.5x†
cold compile solc parity 17.6† 18.2 1029 5 8.4x†
cold compile solc via-ir 144.7† 146.2 3289 5 25.5x†
cold compile solc via-ir parity 46.3† 46.9 1500 5 22.2x†
cold compile solx-0.1.8 23.5‡ 94.5 3759 3 4.1x‡
cold compile solx-0.1.8 parity 10.4† 32.5 1836 5 5.0x†
cold compile solx-0.1.8 via-ir 24.2† 119.0 3163 5 4.3x†
cold compile solx-0.1.8 via-ir parity 10.7† 37.3 1619 5 5.1x†
warm test forge-1.7.1 10.3† 642.6 287 3 0.3x†
warm test forge-1.7.1 via-ir 8.8† 541.2 289 3 0.3x†
warm test forge-1.8.5 solar 17.4† 1087.5 560 3 0.5x†
warm test slang 32.9† 316.5 1226 3
warm test slang parity 32.2† 311.8 1121 3
warm test solc 38.7† 436.8 1401 3 1.2x†
warm test solc parity 38.2† 432.7 1192 3 1.2x†
warm test solc via-ir 36.8† 387.8 1384 3 1.1x†
warm test solc via-ir parity 36.2† 388.8 1188 3 1.1x†
warm test solx-0.1.8 34.5† 335.3 1388 3 1.0x†
warm test solx-0.1.8 parity 33.6† 327.8 1199 3 1.0x†
warm test solx-0.1.8 via-ir 33.3† 329.7 1412 3 parity†
warm test solx-0.1.8 via-ir parity 32.7† 327.5 1201 3 1.0x†

solady-solx

cell wall s CPU s peak RSS MB runs slang speedup
cold compile forge-1.7.1 24.1† 24.3 1658 5 6.6x†
cold compile forge-1.7.1 via-ir 140.5† 140.7 3013 5 38.5x†
cold compile forge-1.8.5 solar 1.1† 5.8 199 5 0.3x†
cold compile slang 3.6‡ 32.9 1186 3
cold compile solc 31.2† 32.1 2301 5 8.6x†
cold compile solc via-ir 147.8† 148.8 3707 5 40.5x†
cold compile solx-0.1.8 20.0‡ 71.5 3759 3 5.5x‡
cold compile solx-0.1.8 via-ir 20.4† 77.9 3225 5 5.6x†
warm test forge-1.7.1 1.0† 39.4 492 3 0.6x†
warm test forge-1.7.1 via-ir 1.0† 40.0 473 3 0.6x†
warm test slang 1.7† 35.7 1248 3
warm test solc 1.8† 37.7 1364 3 1.1x†
warm test solc via-ir 1.9† 39.1 1395 3 1.2x†
warm test solx-0.1.8 1.8† 36.4 1341 3 parity†
warm test solx-0.1.8 via-ir 1.8† 36.6 1363 3 1.1x†
warm test forge-1.8.5 solar ✗ 4 tests fail⁷

uniswap-v4-core-solx

cell wall s CPU s peak RSS MB runs slang speedup
cold compile forge-1.7.1 13.6† 13.8 639 5 7.4x†
cold compile forge-1.7.1 via-ir 71.5† 71.7 1504 5 39.0x†
cold compile forge-1.8.5 solar 0.7† 3.1 142 5 0.4x†
cold compile slang 1.8‡ 13.6 747 3
cold compile solc 17.1† 17.7 926 5 9.3x†
cold compile solc no-opt 7.7† 8.4 1057 5 4.2x†
cold compile solc via-ir 74.9† 75.5 1805 5 40.9x†
cold compile solx-0.1.8 11.1‡ 37.2 2849 3 6.1x‡
cold compile solx-0.1.8 via-ir 10.9† 34.7 1485 5 6.0x†
warm test forge-1.7.1 2.2† 53.7 302 3 0.4x†
warm test forge-1.7.1 via-ir 2.1† 49.2 298 3 0.4x†
warm test forge-1.8.5 solar 2.2† 56.3 304 3 0.4x†
warm test slang 5.8† 29.3 696 3
warm test solc 7.1† 36.4 817 3 1.2x†
warm test solc via-ir 6.5† 34.5 813 3 1.1x†
warm test solx-0.1.8 6.1† 31.5 758 3 1.0x†
warm test solx-0.1.8 via-ir 6.1† 31.2 791 3 1.1x†

¹ solx 0.1.8 cannot compile SwapVM's recursive runLoop: LLVM reports a stackification failure for a recursive function with stack-too-deep errors. slang's LLVM spills in recursive functions and compiles it.

² lido's contracts/upgrade hits a Yul stack-too-deep in solc from 0.8.26 on, at every optimizer setting; slang compiles it.

³ The repo builds via-IR only (its sources don't compile on the legacy pipeline), so it has no legacy cells.

⁴ 149 of aave's 1559 tests use the vm.eip712HashStruct / vm.eip712HashType cheatcodes, whose type table Hardhat builds from the solc AST; a slang build info has none, so those tests fail. The cell is left out until slang's output carries struct definitions.

⁵ solc via-IR cannot compile aave's Foundry test sources (a Yul stack-too-deep in its vendored assembly), so the suite cannot run.

⁶ lido-core also compiles 0.4.24 and 0.6 sources; forge runs solar as its only compiler, so the repo has no forge + solar cell.

⁷ solar's code generation is experimental: these Foundry tests fail under forge + solar but pass under forge with solc, so the cell is left out. On SwapVM, a 1000-round fee-tracking test uses about 39% more gas under solar than under solc and exceeds forge's per-test gas limit.

‡ measured in this run: 41062887585.

† taken from the baseline, not measured in this run; each † links the run that measured it: 40957738104, 41038027064, 41053131682.

@nebasuke
nebasuke had a problem deploying to github-action-benchmark October 9, 2026 14:31 — with GitHub Actions Failure
@nebasuke
nebasuke temporarily deployed to github-action-benchmark October 9, 2026 15:01 — with GitHub Actions Inactive
@nebasuke
nebasuke had a problem deploying to github-action-benchmark October 9, 2026 15:33 — with GitHub Actions Failure
@nebasuke
nebasuke temporarily deployed to github-action-benchmark October 9, 2026 17:57 — with GitHub Actions Inactive
@nebasuke
nebasuke temporarily deployed to github-action-benchmark October 10, 2026 11:11 — with GitHub Actions Inactive
@nebasuke
nebasuke temporarily deployed to github-action-benchmark October 10, 2026 13:24 — with GitHub Actions Inactive
@nebasuke
nebasuke force-pushed the bas/slang-compile-benchmarks branch from 0c090c1 to 0ec625d Compare October 14, 2026 12:52
@nebasuke
nebasuke had a problem deploying to github-action-benchmark October 14, 2026 12:52 — with GitHub Actions Failure
@nebasuke
nebasuke had a problem deploying to github-action-benchmark October 14, 2026 14:12 — with GitHub Actions Error
@nebasuke
nebasuke force-pushed the bas/slang-compile-benchmarks branch from d983c08 to ce309a4 Compare October 14, 2026 15:01
@nebasuke
nebasuke temporarily deployed to github-action-benchmark October 14, 2026 15:02 — with GitHub Actions Inactive
Base automatically changed from bas/hardhat-slang-debug-symbols to main October 20, 2026 08:49
@nebasuke
nebasuke had a problem deploying to github-action-benchmark October 21, 2026 14:03 — with GitHub Actions Failure
Benchmarks the experimental solx compiler against solc on the OpenZeppelin
Hardhat 3 fork (pinned solc 0.8.34), reusing the end-to-end + bench:regression
harness. New scenario end-to-end/openzeppelin-contracts-0.34/ compiles a 2x2
matrix ({solc, solx} x {legacy, via-IR}) plus two non-DWARF solx cells
(HARDHAT_SOLX_DISABLE_DEBUG_INFO) as the DWARF-perf iteration target; records
cold wall + CPU time, deterministic bytecode size (bench:bytecode-size), and
native gas (bench:gas-compare). A dedicated solx-regression-benchmark.yml
workflow (ci:perf-solx label, self-hosted runner) runs only the solx-tagged
scenarios and stores results separately.

Rebuilt on top of the hardhat-solx optimizer-mode fix (#8419); the plugin's
DWARF escape hatch used by the no-dwarf cells is added in the next commit.
…ugin

The non-DWARF compile cells previously relied on an escape hatch baked into
the production hardhat-solx config hook (HARDHAT_SOLX_DISABLE_DEBUG_INFO
gating the DWARF selector injection). That made prod code carry
benchmark-only branching.

Move it to a benchmark-local plugin (scripts/benchmark/no-dwarf-plugin.ts)
that Hardhat registers after hardhat-solx. Because config hooks run in reverse
registration order, this plugin wraps hardhat-solx's resolveUserConfig: it lets
hardhat-solx inject DWARF, then strips those selectors back out when
HARDHAT_SOLX_DISABLE_DEBUG_INFO=true (no-op otherwise). The production plugin is
now byte-identical to the #8419 branch.

preinstall.sh copies the plugin into the scenario clone; the wrapper config
registers it after hardhatSolx. Unit tests cover the pure strip and the
wrap-then-strip ordering.
Adds a best-effort step to the solx regression benchmark that captures the
exact standard-JSON solx receives (via SOLX_STANDARD_JSON_DEBUG) for each of
the four solx profiles — {legacy, via-ir} x {DWARF, no-DWARF} — and uploads
them as an artifact. These can be replayed directly with
`solx --standard-json < input.json` for perf runs without the Hardhat fixture.
Same 2x2 profile matrix as openzeppelin-contracts-0.34 ({solc, solx} x
{legacy, via-IR}, all pinned to solc 0.8.34), DWARF-on only. No source
patches: every pragma in the tree is already a caret range admitting
0.8.34. The base config's multi-compiler shape is re-expressed as the
four benchmark profiles, seeded from the base compiler's settings.

The preinstall adds the packed hardhat-solx tarball as a devDependency;
since that changes the manifest after the lockfile was written, the
scenario env sets pnpm_config_frozen_lockfile=false so CI installs
(frozen by default under CI=true) can resolve the new entry.

Validated locally: all four profiles compile (solc 0.8.34 / solx 0.1.4,
evm target osaka), ~7-9 s per cold cell.
Same 2x2 profile matrix as openzeppelin-contracts-0.34 ({solc, solx} x
{legacy, via-IR}, all pinned to solc 0.8.34), DWARF-on only. The base
config's default profile compiles via IR (matching upstream
foundry.toml), so the wrapper's legacy cells explicitly flip
viaIR: false while keeping the base optimizer settings and
metadata.bytecodeHash: none in every cell.

The preinstall relaxes the tree's single exact pragma
(src/PoolManager.sol, 0.8.26 -> ^0.8.26) via a generic sweep, and adds
the packed hardhat-solx tarball as a devDependency; the scenario env
sets pnpm_config_frozen_lockfile=false so CI installs (frozen by
default under CI=true) can resolve the new manifest entry.

Validated locally (cold, dev machine): solc 24 s, solx 97 s,
solc via-IR 116 s, solx via-IR 53 s; 132 files per cell.
Solx-only timed cells (cold legacy + cold via-IR, 2 runs each — aave-v4
is the heaviest scenario in the set, so PR runs stay quick), with the
full 4-profile wrapper config ({solc, solx} x {legacy, via-IR}, all
pinned to solc 0.8.34, DWARF-on) kept for manual solc-vs-solx runs.
openzeppelin-contracts-0.34 remains the full comparison anchor.

The wrapper seeds every profile from the base default profile's
compiler settings (optimizer runs 444444444444, evmVersion cancun,
metadata.bytecodeHash none) and drops the base's per-file viaIR
overrides (Hub.sol, SpokeInstance.sol) and coverage profile: uniform
cells keep each profile a single homogeneous compiler run.

The preinstall relaxes the 23 exact `pragma solidity 0.8.28;` pragmas
to caret ranges via a generic sweep (submodules untouched) and adds the
packed hardhat-solx tarball as a devDependency; yarn (classic) installs
resolve the new manifest entry without a frozen-lockfile opt-out.

Not compile-validated locally (host CPU constraints); the preinstall
sweep and install were validated via e2e init --use-local.
Keep PR benchmark runs quick: the ens-verifiable-factory and
uniswap-v4-core scenarios drop their solc timing cells and prime only
the solx compiler; uniswap-v4-core (the heavier of the two) also drops
from 3 to 2 hyperfine runs per cell. openzeppelin-contracts-0.34 stays
untouched as the full solx-vs-solc + DWARF comparison anchor.

The 4-profile wrapper configs are unchanged, so the solc profiles
remain available for manual comparison runs (and their apples-to-apples
settings still pin what the solx cells measure).
…enarios

bytecode-size and dump-standard-json previously assumed the single
openzeppelin-contracts-0.34 scenario. Both now accept --tag as an
alternative to --scenario, discovering scenarios the same way
bench:regression's --tag filter does (shared helper in
helpers/scenarios.ts), and loop over the matched set.

dump-standard-json also becomes scenario-aware in two ways:

- The no-DWARF variant pair is only dumped for scenarios whose
  benchmark commands declare no-DWARF cells (the marker for installing
  the noDwarfBenchmarkPlugin). Elsewhere
  HARDHAT_SOLX_DISABLE_DEBUG_INFO is silently ignored and the extra
  dumps would just duplicate the DWARF ones misleadingly.
- Dumps land in a per-scenario subdirectory of --out, so one artifact
  can hold every scenario's dumps without filename collisions.
graph-horizon-solx sets workdir, not workingDirectory, so the validator resolved hardhat from the repo root and never checked the Hardhat the benchmark ran.
Dispatch 40354057390 failed ens and uniswap with ERR_PNPM_TARBALL_INTEGRITY: the runner's pnpm metadata cache pinned a previous run's hardhat 3.22.0. Same steps as regression-benchmark.yml: Bun and Yarn Berry caches in RUNNER_TEMP, removed at the end, and the pnpm metadata cache cleared before the benchmark. install.ts keeps its Yarn eviction for local runs, which get none of this.
A dispatch merged its cells into the baseline even after a scenario failed mid-run (39613382377), and a stale-stamp warning from the local-install check never stopped anything. The validator's --strict mode fails on any warning; the baseline merge and the blog tables need both it and the benchmark to succeed. allow-partial-baseline keeps partial merges for exploratory dispatches.
@nebasuke
nebasuke had a problem deploying to github-action-benchmark October 26, 2026 20:14 — with GitHub Actions Failure
d95c1150 carries solx-llvm's recursive-function spilling (SwapVM's runLoop
now compiles) and the keccak256 string-literal fold that stopped forge-std's
vm constant from bumping the free memory pointer (lido-core's MemUtilsTest).
The 2026-10-29 slang compiles SwapVM's recursive runLoop, so the cell
dropped in 395e536 measures again. solx 0.1.8 still cannot, which is all
footnote 1 now covers.
With the 2026-10-29 slang, lido-core's test sources compile and all 216
tests pass, as under solc and solx 0.1.8. Warm and cold test cells feed
the comment and the blog's test row; the cold one matches the measured
cold test the other compilers have in this scenario.
TestPlus's PRNG hashes the free memory pointer, so its draws follow the
compiler's memory layout. Under slang d95c1150 the unauthorized caller in
ERC6551Test#testExecute comes out as the account owner and the expected
revert never happens. solc, solx 0.1.8 and forge draw a non-owner first,
so they run exactly as before; all 2040 solady tests pass on each.
@nebasuke
nebasuke had a problem deploying to github-action-benchmark October 29, 2026 21:08 — with GitHub Actions Error
@nebasuke
nebasuke had a problem deploying to github-action-benchmark October 29, 2026 21:10 — with GitHub Actions Error
The validator walks every clone under /tmp/end-to-end, including scenarios
the run's filter skipped and never installed, so --strict failed PR run
40393926917 over swap-vm's leftover clone while the benchmark itself
passed. It now only warns unless a dispatch sets strict-validation.
@nebasuke
nebasuke temporarily deployed to github-action-benchmark October 29, 2026 21:17 — with GitHub Actions Inactive
@nebasuke
nebasuke had a problem deploying to github-action-benchmark October 29, 2026 21:25 — with GitHub Actions Failure
Full dispatch on 22684d0 with slang d95c1150 (cold compile, cold test,
warm test). Replaces the cc66c013-era slang cells and fills the new swap-vm
compile and lido-core test cells the PR comment borrows.
The suite compiles at the 0.8.34 pin after all: solc via-IR and forge pass
706/706, slang 705. The one slang failure is a TWAP test whose expected
amounts only hold when the compiler re-reads block.timestamp after vm.warp,
as solc via-IR does; preinstall takes it out of discovery for every
compiler. forge + solar gets no test cell: a 1000-round fee-tracking test
spends about 39% more gas under solar and exceeds forge's per-test limit.
aqua, ens, OZ and Uniswap v4 pass their whole Foundry suites under forge
1.8.5 + solar. graph-horizon (14), Solady (4) and Aave (208) have tests that
fail only under solar, so they get no cell.
The comment's test tables gain the forge solar column, from solar's cold
compile plus warm test like the other columns. Repos without a solar test
cell say why, and lido-vaults' test row points at lido-core, which measures
the suite it shares.
@nebasuke
nebasuke temporarily deployed to github-action-benchmark October 30, 2026 10:04 — with GitHub Actions Inactive
@nebasuke
nebasuke had a problem deploying to github-action-benchmark October 30, 2026 10:04 — with GitHub Actions Failure
The new swap-vm test cells and the forge + solar test cells for aqua, OZ
and Uniswap v4. The run failed before measuring ens (a GitHub download timed
out in its preinstall), so the workflow skipped the merge; its other
scenarios completed and are merged here by hand.
@nebasuke
nebasuke temporarily deployed to github-action-benchmark October 30, 2026 12:08 — with GitHub Actions Inactive
@nebasuke
nebasuke had a problem deploying to github-action-benchmark October 30, 2026 12:08 — with GitHub Actions Failure
ens's forge + solar test cell, the one cell dispatch 41038027064 did not
reach.
@nebasuke
nebasuke temporarily deployed to github-action-benchmark October 30, 2026 12:38 — with GitHub Actions Inactive
The solar note still said compile tables only after solar gained test
cells, and each scenario heading showed its first cell's run count although
cells there run 1, 3 or 5 times; the runs column already has the right count.
@nebasuke
nebasuke had a problem deploying to github-action-benchmark October 30, 2026 13:10 — with GitHub Actions Error
Only borrowed values named a run (†); the slang and solx-0.1.8 cells the
PR run measured itself carried no mark, so their source had to be inferred
from the footnote. They now get ‡ with a link to the run, and the footnote
defines both. The blog tables, rendered without a run URL, are unchanged.
The two renderers' identical mark helpers become one shared runMark.
@nebasuke
nebasuke temporarily deployed to github-action-benchmark October 30, 2026 13:24 — with GitHub Actions Inactive
@kanej kanej closed this Nov 9, 2026
@hedgar2017
hedgar2017 deleted the bas/slang-compile-benchmarks branch November 24, 2026 17:56

This branch was previously deployed

1 inactive deployment
github-action-benchmark — 4699c68b Deployed Oct 30, 2026 by nebasuke via Slang regression benchmark #36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:perf-slang no changeset needed This PR doesn't require a changeset no docs needed This PR doesn't require links to documentation no peer bump needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants