btcd
btcd copied to clipboard
btcec: Optimize field inversion.
This uses the addition chain from Brian Smith's website to speed up the inversion algorithm for btcec/field.go.
It gets back the sig-verify speed lost in #1084 😄 .
benchmark old ns/op new ns/op delta
----------------------------------------------------------------------
BenchmarkAddJacobian-8 550 552 +0.36%
BenchmarkAddJacobianNotZOne-8 1124 1128 +0.36%
BenchmarkScalarBaseMult-8 49320 48393 -1.88%
BenchmarkScalarBaseMultLarge-8 50016 48749 -2.53%
BenchmarkScalarMult-8 160763 158805 -1.22%
BenchmarkNAF-8 867 870 +0.35%
BenchmarkSigVerify-8 256511 251033 -2.14%
BenchmarkFieldNormalize-8 13.7 13.7 0.00%
@davecgh Any chance we can get this into 0.13.0?
@jcvernaleo (as per #1530)
- Low priority
- Enhancement