eth.zig

Benchmarks

The ten hot-path operations eth.zig tracks release over release, and how they are measured.

eth.zig benchmarks itself against its own previous releases. The suite is the ten operations that dominate a trading bot, liquidator or searcher hot loop.

BenchmarkWhat it measures
keccak256_32bselector, storage-slot and mapping-key hashing
keccak256_1kbcalldata- and transaction-sized hashing
secp256k1_signsigning a transaction hash
secp256k1_recoverrecovering a sender from a signature
tx_hash_eip1559RLP-encoding an EIP-1559 transaction and hashing it
abi_encode_transferencoding transfer(address,uint256) calldata
abi_decode_dynamicdecoding (string,bytes) return data
u256_mulDivfull-precision a*b/c with a 512-bit intermediate
u256_uniswapv4_swapone exact-in swap-step price update
dex_decode_universal_routerdecoding a real 4-command Universal Router execute

Latest results

Apple M4, 2026-10-10, fastest of 7 interleaved runs. Baseline: v0.9.2 on Zig 0.16.0.

Benchmarkv0.9.2 (Zig 0.16)v0.10.1 (Zig 0.17)change
keccak256_32b136.66 ns136.55 ns-0.1%
keccak256_1kb1043.85 ns1047.39 ns+0.3%
secp256k1_sign11421.14 ns11390.99 ns-0.3%
secp256k1_recover15159.87 ns15158.16 ns0.0%
tx_hash_eip1559142.99 ns143.49 ns+0.3%
abi_encode_transfer18.77 ns18.74 ns-0.2%
abi_decode_dynamic15.77 ns16.95 ns+7.5%
u256_mulDiv12.79 ns13.00 ns+1.6%
u256_uniswapv4_swap24.09 ns21.94 ns-8.9%
dex_decode_universal_router(new)154.04 ns

Running

zig build bench                              # all ten
zig build bench -- --filter keccak           # a subset
zig build bench -- --save results.json       # save a run
zig build bench -- --baseline results.json   # compare with a saved run

Measurement

Each benchmark warms up for 200 ms, then reports the median ns/op over 31 batches of about 10 ms, with the minimum and median absolute deviation alongside. Inputs are read through an optimizer barrier on every call so nothing is constant-folded. To compare two versions, build both with zig build bench-install --prefix DIR and interleave them with python3 bench/ab.py OLD NEW, which keeps each benchmark's fastest run so interference from the rest of the machine cancels out. Full details are in bench/README.md.

On this page