viem-goviem-go

Performance

Benchmark comparisons between viem-go and TypeScript viem across all test suites

viem-go is benchmarked head-to-head against TypeScript viem across 59 individual tests spanning 9 suites. Both runtimes target the same Anvil instance (mainnet fork) for a fair comparison.

Overview

MetricGo (viem-go)TypeScript (viem)
Geometric mean speedup7.12x-
Avg ns/op2,020,98210,567,395
Avg ops/s49595
Wins59/590/59
Benchmarks are run against a local Anvil instance (mainnet fork). Real-world performance will vary depending on your RPC provider, network latency, and workload shape.

Suite averages

SuiteBenchmarksGo avg (ns/op)TS avg (ns/op)Go avg (ops/s)TS avg (ops/s)Avg speedup
abi64284,2753,445,808626,60510.00x
address54884,27511,011,3792,126,5708.75x
call6196,05815,262,7145,23074177.85x
ens51,27114,6531,446,853336,58711.53x
event314,786368,891613,58436,19824.95x
hash71,25714,4521,938,169193,15611.50x
multicall167,371,36432,964,6652,2581,0924.47x
signature510,942627,2051,443,857158,89557.32x
unit69420811,370,7055,193,7402.21x

Interactive charts

Use the dropdown to switch between suites and click through individual benchmark comparisons. Each chart shows the total execution time over all iterations — lower is better.

1 / 6Encode Simple

Basic single-argument ABI encoding. Go's compiled encoder is ~32x faster than viem's JS runtime encoder for simple types.

Go
encoded, _ := abi.Encode([]string{"uint256"}, big.NewInt(42))

Detailed results

Abi (6 benchmarks)
BenchmarkGo (ns/op)TS (ns/op)Go (ops/s)TS (ops/s)Result
Abi_EncodeSimple2156,8274,659,832146,473Go 31.81x faster
Abi_EncodeComplex5447,6771,838,235130,262Go 14.11x faster
Abi_EncodeMultiArg6858,3181,459,002120,224Go 12.14x faster
Abi_DecodeResult1159778,733,6241,023,132Go 8.54x faster
Abi_EncodePacked5236701,912,0461,492,562Go 1.28x faster
Abi_EncodePackedMulti4831,1812,072,109846,977Go 2.45x faster
Address (5 benchmarks)
BenchmarkGo (ns/op)TS (ns/op)Go (ops/s)TS (ops/s)Result
Address_IsAddress3823326,116,4794,293,464Go 6.08x faster
Address_IsAddressLower5923917,044,4864,178,762Go 4.08x faster
Address_Checksum9951410,112,2461,945,403Go 5.20x faster
Address_Create1,1677,163856,898139,611Go 6.14x faster
Address_Create21,07913,226926,78475,610Go 12.26x faster
Call (6 benchmarks)
BenchmarkGo (ns/op)TS (ns/op)Go (ops/s)TS (ops/s)Result
Call_Basic274,38118,601,0873,64554Go 67.79x faster
Call_WithData187,54218,737,5405,33253Go 99.91x faster
Call_WithAccount175,643239,6695,6934,172Go 1.36x faster
Call_Decimals174,22417,801,5455,74056Go 102.18x faster
Call_Symbol180,63518,073,8035,53655Go 100.06x faster
Call_BalanceOfMultiple183,92118,122,6405,43755Go 98.53x faster
Ens (5 benchmarks)
BenchmarkGo (ns/op)TS (ns/op)Go (ops/s)TS (ops/s)Result
Ens_Namehash1,66120,762602,04748,165Go 12.50x faster
Ens_NamehashDeep3,02943,586330,14222,943Go 14.39x faster
Ens_Labelhash4345,3992,304,678185,214Go 12.44x faster
Ens_Normalize3499662,864,5091,034,895Go 2.77x faster
Ens_NormalizeLong8832,5531,132,888391,720Go 2.89x faster
Event (3 benchmarks)
BenchmarkGo (ns/op)TS (ns/op)Go (ops/s)TS (ops/s)Result
Event_DecodeTransfer63910,2101,564,45697,939Go 15.97x faster
Event_DecodeBatch103,982103,642251,1309,649Go 26.03x faster
Event_DecodeBatch10039,738992,82225,1651,007Go 24.98x faster
Hash (7 benchmarks)
BenchmarkGo (ns/op)TS (ns/op)Go (ops/s)TS (ops/s)Result
Hash_Keccak256Short43520,1742,301,49649,568Go 46.43x faster
Hash_Keccak256Long2,81248,695355,61920,536Go 17.32x faster
Hash_Keccak256Hex4605,2642,175,332189,971Go 11.45x faster
Hash_Sha256Short1611,4286,211,180700,346Go 8.87x faster
Hash_Sha256Long63212,8631,582,02877,740Go 20.35x faster
Hash_FunctionSelector1,9206,319520,833158,242Go 3.29x faster
Hash_EventSelector2,3776,423420,698155,691Go 2.70x faster
Multicall (16 benchmarks)
BenchmarkGo (ns/op)TS (ns/op)Go (ops/s)TS (ops/s)Result
Multicall_Basic182,793459,4555,4712,176Go 2.51x faster
Multicall_WithArgs189,193364,0495,2862,747Go 1.92x faster
Multicall_MultiContract220,815374,5854,5292,670Go 1.70x faster
Multicall_10Calls227,875463,7194,3882,156Go 2.03x faster
Multicall_30Calls377,187914,2612,6511,094Go 2.42x faster
Multicall_Deployless352,429558,1382,8371,792Go 1.58x faster
Multicall_TokenMetadata202,770372,5814,9322,684Go 1.84x faster
Multicall_50Calls484,1571,253,9972,065797Go 2.59x faster
Multicall_100Calls869,6672,150,9541,150465Go 2.47x faster
Multicall_200Calls1,410,8314,344,237709230Go 3.08x faster
Multicall_500Calls2,172,9468,864,462460113Go 4.08x faster
Multicall_MixedContracts_100843,8302,149,1511,185465Go 2.55x faster
Multicall_1000Calls2,909,35716,605,50334460Go 5.71x faster
Multicall_10000Calls_SingleRPC66,612,371162,662,459156Go 2.44x faster
Multicall_10000Calls_Chunked18,517,578164,741,932546Go 8.90x faster
Multicall_10000Calls_AggressiveChunking22,368,029161,155,160456Go 7.20x faster
Signature (5 benchmarks)
BenchmarkGo (ns/op)TS (ns/op)Go (ops/s)TS (ops/s)Result
Signature_HashMessage7726,7331,295,672148,522Go 8.72x faster
Signature_HashMessageLong1,80914,494552,79268,996Go 8.01x faster
Signature_RecoverAddress25,8771,569,68638,644637Go 60.66x faster
Signature_VerifyMessage26,0621,543,37738,370648Go 59.22x faster
Signature_ParseSignature1891,7375,293,806575,671Go 9.20x faster
Unit (6 benchmarks)
BenchmarkGo (ns/op)TS (ns/op)Go (ops/s)TS (ops/s)Result
Unit_ParseEther6531515,396,4593,170,982Go 4.86x faster
Unit_ParseEtherLarge1302357,680,4924,252,017Go 1.81x faster
Unit_FormatEther1161458,605,8526,915,772Go 1.24x faster
Unit_ParseUnits68921111,196,9544,737,299Go 2.36x faster
Unit_ParseGwei6720114,992,5044,982,042Go 3.01x faster
Unit_FormatUnits9714110,351,9677,104,329Go 1.46x faster

Methodology

  • Go benchmarks: Standard testing.B benchmarks with -benchmem
  • TypeScript benchmarks: Vitest bench with matching iteration counts
  • Environment: Both runtimes target the same local Anvil instance (mainnet fork) on Apple M4 Pro
  • Iterations: CPU-bound suites use 5,000 iterations; RPC-bound suites (call, multicall) use 5 iterations
  • Metric: Total wall-clock time over all iterations, measured per-operation then multiplied