diff --git a/dcrec/secp256k1/bench_test.go b/dcrec/secp256k1/bench_test.go index 2b2681856a..813d5070e4 100644 --- a/dcrec/secp256k1/bench_test.go +++ b/dcrec/secp256k1/bench_test.go @@ -53,7 +53,7 @@ func BenchmarkAddNonConstNotZOne(b *testing.B) { } // BenchmarkScalarBaseMultNonConst benchmarks multiplying a scalar by the base -// point of the curve. +// point of the curve using whichever variant is active. func BenchmarkScalarBaseMultNonConst(b *testing.B) { k := hexToModNScalar("d74bf844b0862475103d96a611cf2d898447e288d34b360bc885cb8ce7c00575") @@ -65,6 +65,32 @@ func BenchmarkScalarBaseMultNonConst(b *testing.B) { } } +// BenchmarkScalarBaseMultNonConstFast benchmarks multiplying a scalar by the +// base point of the curve using the fast variant. +func BenchmarkScalarBaseMultNonConstFast(b *testing.B) { + k := hexToModNScalar("d74bf844b0862475103d96a611cf2d898447e288d34b360bc885cb8ce7c00575") + + b.ReportAllocs() + b.ResetTimer() + var result JacobianPoint + for i := 0; i < b.N; i++ { + scalarBaseMultNonConstFast(k, &result) + } +} + +// BenchmarkScalarBaseMultNonConstSlow benchmarks multiplying a scalar by the +// base point of the curve using the resource-constrained slow variant. +func BenchmarkScalarBaseMultNonConstSlow(b *testing.B) { + k := hexToModNScalar("d74bf844b0862475103d96a611cf2d898447e288d34b360bc885cb8ce7c00575") + + b.ReportAllocs() + b.ResetTimer() + var result JacobianPoint + for i := 0; i < b.N; i++ { + scalarBaseMultNonConstSlow(k, &result) + } +} + // BenchmarkSplitK benchmarks decomposing scalars into a balanced length-two // representation. func BenchmarkSplitK(b *testing.B) {