Documentation menu
Compiler

Benchmarks against Solidity

Runtime size, deployment gas and individual calls for the four teaching contracts, compared with solc on the same workloads.

Find a section6 sections

How it is measured

Counter, Token, Pool and Lending each have a Solidity equivalent. The suite deploys each implementation on hevm (Osaka), then sends it the same sequence of transactions. Pool calls two tokens; Lending also depends on a reward token and a price oracle. The Solidity compiler is solc 0.8.33, with optimization at 200 runs and no CBOR metadata. The via-IR pipeline is the baseline for ratios.

Execution gas is the gas a transaction uses before refunds and the EIP-7623 floor, less its intrinsic gas. Deployment gas includes every transaction needed to install the contract; runtime bytes include every account created by installation. A mean is specific to the steps shown, not a guarantee about future calls. Matching ABI data is checked for status, output and logs against both Solidity pipelines. Native calls may have a different encoding.

Results

just evm-benchmarks --teaching prints the tables below. The full compiler comparison also records specialized regression workloads.

ExampleEquivalentOmegyu bytessolc via-IR bytesRatioOmegyu installationOmegyu deployment gassolc via-IR deployment gasMean native ÷ via-IRMean ABI ÷ via-IR
Counterexact8154191.95one contract232,336147,5031.001.01
Tokenexact2,8251,3392.11one contract711,171391,3380.920.96
Poolexact4,7682,2702.10one contract1,083,705545,1050.940.96
Lendingexact23,1216,8093.40one contract5,063,2281,576,8610.930.94

Counter

StepStatusNativeABIsolc via-IRsolc legacyNative ÷ via-IRABI ÷ via-IR
increment, from 0 (first write)ok22,23322,23322,32822,3111.001.00
increment, from 1ok5,1335,1335,2285,2110.980.98
add 5ok5,2395,3355,2475,3681.001.02
addTimes 5, 3 timesok5,3175,4065,3715,5550.991.01
addTimes 5, 0 timesok2,5172,6062,5712,7550.981.01
addAll of 3 wordsok5,784—5,8076,0631.00—
addAll of no wordsok2,645—2,5962,7321.02—
countok2,2392,2742,2472,2591.001.01
add, overflow (Panic)revert2,4202,4582,3412,4171.031.05
arithmetic mean1.001.01
geometric mean1.001.01

Token

StepStatusNativeABIsolc via-IRsolc legacyNative ÷ via-IRABI ÷ via-IR
mint 100 to a new holder, by the ownerok28,90029,29229,38329,4710.981.00
mint, not by the owner (Unauthorized)revert3403503734010.910.94
transfer 10 to a holderok11,80712,25512,50612,6410.940.98
transfer 10 to a new holderok28,90729,35529,60629,7410.980.99
transfer, insufficient balancerevert2,5032,5342,6632,7460.940.95
transferRaw 10 to a holderok11,710—12,46612,5490.94—
approve 50, a new allowanceok23,93624,36524,30524,5190.981.00
approve 60, an allowance againok6,8367,2657,2057,4190.951.01
transferFrom 20, by the spenderok17,00917,48417,82418,1180.950.98
transferFrom, insufficient allowancerevert2,6422,6922,6692,8610.991.01
balanceOfok2,3592,4522,5292,5410.930.97
allowanceok2,4932,5962,7822,7990.900.93
totalSupplyok2,2832,3472,2922,3391.001.02
decimals (an immutable)ok2132692392920.891.13
nameok3283343803790.860.88
symbolok3083545454330.570.65
arithmetic mean0.920.96
geometric mean0.910.96

Pool

StepStatusNativeABIsolc via-IRsolc legacyNative ÷ via-IRABI ÷ via-IR
addLiquidity, first depositok139,512139,794140,643140,8690.990.99
swapExact0For1 10^6ok41,03041,76542,16642,5450.970.99
swapExact1For0 10^6ok40,97741,76642,23742,5930.970.99
swap, slippage (Slippage)revert2,8592,9033,0293,3750.940.96
addLiquidity 10^6 and 4 * 10^6ok53,82354,09654,44154,5870.990.99
removeLiquidity 10^6 sharesok48,78149,29549,82049,8240.980.99
removeLiquidity, without shares (NoShares)revert4,8164,8867,1567,2790.670.68
getReservesok2,3372,3772,3342,4751.001.02
sharesOfok2,3352,4522,4952,5820.940.98
totalSharesok2,2402,2972,3382,3160.960.98
arithmetic mean0.940.96
geometric mean0.940.95

Lending

StepStatusNativeABIsolc via-IRsolc legacyNative ÷ via-IRABI ÷ via-IR
supply 10^24, the first supplierok84,18584,70587,82287,7190.960.96
supply 5 * 10^23, a second supplierok57,73658,25159,31059,7690.970.98
supply, zero assets (ZeroAssets)revert5836549949170.590.66
supplyCollateral 10^21ok59,34059,79960,39360,5280.980.99
borrow 10^21, the first borrowok67,38667,85969,28970,1320.970.98
accrueInterest a day laterok18,24918,24018,86419,3280.970.97
accrueInterest again, in the same blockok2,7982,7887,5677,4690.370.37
borrow 2 * 10^20 more, an hour laterok53,08653,55954,98955,8320.970.97
borrow beyond the threshold (Unhealthy)revert35,85235,88737,11637,9530.970.97
repay 5 * 10^26 sharesok50,23250,70251,67652,6930.970.98
withdraw 10^23ok41,02441,48642,21743,0810.970.98
withdraw more than supplied (InsufficientShares)revert20,56620,57921,06621,9300.980.98
withdrawCollateral 10^20, still healthyok45,57946,02447,24847,8580.960.97
withdrawCollateral beyond the threshold (Unhealthy)revert28,64928,70529,69430,3050.960.97
setFee 10%, by the ownerok19,56019,59120,12520,7890.970.97
setFee, not by the owner (Unauthorized)revert5775956527130.880.91
setRewardRate 10^15 a secondok43,81243,86044,49945,2190.980.99
accrueInterest a week later, with the feeok47,57347,56448,28748,7080.990.99
claimRewardsok91,32391,822113,139113,6680.810.81
pendingRewardsok13,32113,44513,36413,8481.001.01
marketok6,7776,9146,7636,7851.001.02
positionok4,5574,6434,8694,8540.940.95
borrowRateok4,6844,6554,8504,7460.970.96
isHealthy, healthyok14,59814,65715,42515,9090.950.95
liquidate a healthy position (Healthy)revert38,01438,04138,84539,4380.980.98
isHealthy, after the price fallsok14,59814,65715,42515,9090.950.95
liquidate 10^20 of collateralok105,296105,802107,365107,9380.980.99
liquidate more than the collateral (InsufficientCollateral)revert38,03938,06538,86739,4820.980.98
liquidate all the collateral, with bad debtok88,22888,73490,60291,0530.970.98
position after the bad debtok4,5574,6434,8694,8540.940.95
setFeeRecipientok23,74223,93624,76225,2500.960.97
supply 10^22 after the bad debt, an hour laterok45,65546,17047,23347,6840.970.98
arithmetic mean0.930.94
geometric mean0.920.93