During this week I completed all the benchmarks I was planning to do. I found some errors in the previous benchmark I coded using criterion
and I spent time this week correcting those errors and running the new benchmarks.
All benchmark results can be accessed through the github repository https://github.com/mdvillagra/poseidon-benchmarks.
The main comparisons are shown in the plot below.
In this graphic, we have tested inputs of sizes 256, 512, 768 and 1024 bits. Risc0 have two implementations, one with the BLS12-381 scalar field of 255 bits and another with the Babybear field of 31 bits.
Right now, the repository is in a state where it is very easy to add any other Poseidon instantiation as a submodule and then prepare the benchmark for it and just run it. All stats are generated using criterion
. Independent of EIP-5988, this repository is useful by itself for further research into the Poseidon hash function.
From now on, I will work on finishing a Poseidon implementation in Solidity and writing a technical report in academic style. This will also include a proposal of gas costs for a potential precompile of Poseidon.