Repository navigation
Conversation
|
slang benchmarksslang 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 compilationBuilding all 10 repos one after another takes solc 993s in total, and it takes slang 63s. A 15.6x overall improvement.
slang vs solc in legacy mode (without --via-ir) compilationBuilding all 7 repos one after another takes solc 154s in total, and it takes slang 18s. A 8.7x overall improvement.
slang vs solc --via-ir including Solidity testsBuilding all 8 repos one after another takes solc 1121s in total, and it takes slang 172s. A 6.5x overall improvement.
slang vs solc in legacy mode (without --via-ir) including Solidity testsBuilding all 6 repos one after another takes solc 203s in total, and it takes slang 62s. A 3.3x overall improvement.
1inch-aqua-solx
1inch-swap-vm-solx
aave-v4-solx
ens-verifiable-factory-solx
graph-horizon-solx
lidofinance-core-solx
lidofinance-vaults-solx
openzeppelin-contracts-0.34
solady-solx
uniswap-v4-core-solx
¹ solx 0.1.8 cannot compile SwapVM's recursive ² 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 ⁵ 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. |
0c090c1 to
0ec625d
Compare
d983c08 to
ce309a4
Compare
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.
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.
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.
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.
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.
ens's forge + solar test cell, the one cell dispatch 41038027064 did not reach.
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.
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.
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 ownslangbaselines, 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 andshell.tsreplace the hyperfine quoting fix) and089630a8b(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-cellignoreFailureplus keep-finished-entries change is ported ontorunSeries/runPlain. #8415 merged main four times; those merges carried the plugin rename tohardhat-slang-solxacross the scenario wrappers, which a linear replay drops, sod73f9080brestores every file #8415 created to its content at #8415's head.replay-standard-json.tsstill calls hyperfine, which CI no longer installs; it is outside the slang workflow.slang in the scenarios
hardhat-slangis registered in every wrapper config with a singleslangprofile: slang has one pipeline, neither legacy nor via-IR, so there is no via-IR twin andviaIRnever reaches it (per-file via-IR overrides included).pinned-tool-versions.sh(solx prereleased95c1150, hardhat-slang's0.1.0-pre.2026-10-29), downloaded and sha256-verified byprovision-slang.tsand passed throughhardhat-slang'spathoption.HARDHAT_SLANG_BENCH_BINARYsubstitutes a local build.cold compile slang(plus OZ's forge-scopeparityand lido-vaults'upgradevariants) and, where the suite runs under slang,warm test slang; lido-core also hascold test slang, like its other compilers.HHE821: invalid key "default.disable_block_gas_limit").ERC6551Test#testExecuteredraws 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.TWAPSwapTest#test_TWAP_CumulativeSoldTracking_Multiple_Swapsis taken out of discovery. Its expected amounts only hold when the compiler re-readsblock.timestampaftervm.warp, as solc via-IR does; slang keeps the local, as the source says.forge + solar
cold compile forge-1.8.5 solarruns 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 solarruns 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.ymlruns on the self-hosted runner for PRs labelledci:perf-slang, dispatches and main pushes, in two tiers:cold compile slang*andcold 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.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 theslang-baseline-report-mergedartifact. Refreshing the baseline is copying that artifact over the committed file. The merge and the blog tables need the benchmark to succeed, unlessallow-partial-baselineis set;strict-validationalso 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_TEMPand 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 theslangdata dir withfail-on-alertoff. 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 resultfails on the enterprise's fine-grained PAT lifetime policy forBENCHMARK_GITHUB_TOKEN; the report, merged baseline and blog tables are still produced.Known gaps
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).runLoop; slang compiles it.