ethsign
ethsign copied to clipboard
Signature verification is very slow.
Hi @tomusdrw !
I used this library for eth signature verification.
The main issue that I have with it is that it is very slow. recover
is around 3ms, but using rust bindings to native library (that you use under the hood) recover
is around 66us. I found reason for this is that you create secp256k1::Secp256k1::verification_only()
for every signature verification, this function by itself costs around 2.7 ms so it sums up.
Consider adding benchmarks, also I would suggest using thread_local to store secp256k1::Secp256k1::verification_only()
objects.
Sincerely, Vitaly.
Hi @dvush!
For now it was a concious decision to not focus on performance, thanks for the input, we already have a similar issue here: https://github.com/tomusdrw/ethsign/issues/14.
I'm definitely up for introducing benchmarks and lazy_static
or thread_local
to alleviate low performance. PRs welcome!
Thanks for response, I'll try to create PR with benchmarks at least, since I already done them in our project.