# Go-ethereum Benchmark Update for EVM384 and Friends
A tentative specification for extension of modular arithmetic support to bitwidths beyond 256-bits in the EVM is outlined in https://notes.ethereum.org/@poemm/eip_draft_evm_modular_arithmetic_extensions .
A Go-ethereum [implementation](https://github.com/jwasinger/go-ethereum/tree/evm-mod-ext) has been created for the purposes of measuring the performance of a portable (non-assembly) implementation of the arithmetic as well as the overhead of the client "boilerplate" code.
Benchmarks were measured on an i5-6600K processor (3.5 GHz). 10 ns / gas was chosen as a (conservative) target gas rate. Benchmarks are presented alongside pricing models proposed in the EIP draft.
For more context, client benchmarks of a Go-assembly [implementation](https://github.com/sean-sn/blst_evm384) of the arithmetic for 384-bit values are also shown.
Note that benchmarks aim to show the worst-case performance (final subtraction performed for `MULMONT`, slowest [paths](https://github.com/jwasinger/mont-arith/blob/272a9c3e3a958fb025cb781fdbbbb11fb7caa2f6/templates/addmod.go.template#L29) for `ADDMONT`/`SUBMONT`). Performance of `MULMONT` at larger bitwidths is omitted because 1) the implementation is currently unnacceptably slow after 9 limbs (576 bits) and 2) the performance can vary considerably based on values that are chosen (widths above 576 bits implement generic montgomery multiplication using the Go standard library's `big.Int` which does allocations under the hood)
## EVM BLS12381 Pairing Benchmarks
Benchmarks for the [Miller Loop](https://github.com/jwasinger/go-ethereum/blob/evm-mod-ext/bench_miller_loop.sh) and [Final Exponentation](https://github.com/jwasinger/go-ethereum/blob/evm-mod-ext/bench_final_exp.sh) are from test cases provided by [EVMcurves](https://github.com/poemm/EVMcurves).
For the raw benchmark data, traces and scripts to produce the graphs, see https://github.com/jwasinger/plots/tree/master/mont-arith-bench