diff --git a/btcec/bench_test.go b/btcec/bench_test.go index 9986e592..bebd886f 100644 --- a/btcec/bench_test.go +++ b/btcec/bench_test.go @@ -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() + } +}