From d22d366025f653782ea14b9197f51da811e4e983 Mon Sep 17 00:00:00 2001 From: emanuele francioni Date: Wed, 21 Aug 2019 11:17:39 +0200 Subject: [PATCH] removed key generation from benchmak loop to speed up benchmark (as it does not influence the benchmark) --- bls/bls_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bls/bls_test.go b/bls/bls_test.go index 5b44997..7d40bdb 100644 --- a/bls/bls_test.go +++ b/bls/bls_test.go @@ -291,12 +291,13 @@ func TestAmbiguousCompress(t *testing.T) { func BenchmarkSign(b *testing.B) { msg := randomMessage() + pk, sk, _ := GenKeyPair(rand.Reader) + + b.ReportAllocs() b.StopTimer() b.ResetTimer() for i := 0; i < b.N; i++ { - pk, sk, _ := GenKeyPair(rand.Reader) - b.StartTimer() _, _ = Sign(sk, pk, msg) b.StopTimer() @@ -314,6 +315,8 @@ func aggregateXSignatures(b *testing.B, nr int) { } s, sigmas := sigmas[0], sigmas[1:] + + b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { for _, sig := range sigmas { @@ -336,11 +339,12 @@ func BenchmarkAggregate1000Signatures(b *testing.B) { func BenchmarkVerifySingleSignature(b *testing.B) { msg := randomMessage() + pk, sk, _ := GenKeyPair(rand.Reader) b.StopTimer() b.ResetTimer() + b.ReportAllocs() for i := 0; i < b.N; i++ { - pk, sk, _ := GenKeyPair(rand.Reader) signature, _ := Sign(sk, pk, msg) b.StartTimer()