Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
secp256k1: Add benchmark for field normalization.
Browse files Browse the repository at this point in the history
davecgh committed Jun 9, 2017
1 parent 32ba1b0 commit ccf7a2b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dcrec/secp256k1/bench_test.go
Original file line number Diff line number Diff line change
@@ -112,3 +112,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()
}
}

0 comments on commit ccf7a2b

Please sign in to comment.