btcec: Add benchmark for field normalization.

This commit is contained in:
Dave Collins 2017-06-07 11:12:11 -05:00
parent ef87de9d88
commit 711e7dbb2e
No known key found for this signature in database
GPG key ID: B8904D9D9C93D1F2

View file

@ -111,3 +111,13 @@ func BenchmarkSigVerify(b *testing.B) {
sig.Verify(msgHash.Bytes(), &pubKey)
}
}
// BenchmarkFieldNormalize benchmarks how long it takes the internal field
// to perform normalization (which includes modular reduction).
func BenchmarkFieldNormalize(b *testing.B) {
// The normalize function is constant time so default value is fine.
f := new(fieldVal)
for i := 0; i < b.N; i++ {
f.Normalize()
}
}