diff --git a/crypto/bn256/cloudflare/bn256_test.go b/crypto/bn256/cloudflare/bn256_test.go index 481e2f78c3..0e3fd50c89 100644 --- a/crypto/bn256/cloudflare/bn256_test.go +++ b/crypto/bn256/cloudflare/bn256_test.go @@ -107,23 +107,21 @@ func TestG2SelfAddition(t *testing.T) { func BenchmarkG1(b *testing.B) { x, _ := rand.Int(rand.Reader, Order) - b.ResetTimer() - for i := 0; i < b.N; i++ { + for b.Loop() { new(G1).ScalarBaseMult(x) } } func BenchmarkG2(b *testing.B) { x, _ := rand.Int(rand.Reader, Order) - b.ResetTimer() - for i := 0; i < b.N; i++ { + for b.Loop() { new(G2).ScalarBaseMult(x) } } func BenchmarkPairing(b *testing.B) { - for i := 0; i < b.N; i++ { + for b.Loop() { Pair(&G1{curveGen}, &G2{twistGen}) } } diff --git a/crypto/bn256/google/bn256_test.go b/crypto/bn256/google/bn256_test.go index a4497ada9b..d261a74dc6 100644 --- a/crypto/bn256/google/bn256_test.go +++ b/crypto/bn256/google/bn256_test.go @@ -305,7 +305,7 @@ func TestTripartiteDiffieHellman(t *testing.T) { } func BenchmarkPairing(b *testing.B) { - for i := 0; i < b.N; i++ { + for b.Loop() { Pair(&G1{curveGen}, &G2{twistGen}) } }