btcd icon indicating copy to clipboard operation
btcd copied to clipboard

btcec: Optimize field inversion.

Open bmperrea opened this issue 7 years ago • 3 comments

This uses the addition chain from Brian Smith's website to speed up the inversion algorithm for btcec/field.go.

bmperrea avatar Dec 03 '17 22:12 bmperrea

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%

bmperrea avatar Dec 03 '17 22:12 bmperrea

@davecgh Any chance we can get this into 0.13.0?

bmperrea avatar May 13 '18 11:05 bmperrea

@jcvernaleo (as per #1530)

  • Low priority
  • Enhancement

jakesylvestre avatar Mar 04 '20 14:03 jakesylvestre