Skip to content

Commit

Permalink
removed key generation from benchmak loop to speed up benchmark (as i…
Browse files Browse the repository at this point in the history
…t does not influence the benchmark)
  • Loading branch information
autholykos committed Aug 21, 2019
1 parent acdca3f commit d22d366
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bls/bls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 {
Expand All @@ -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()
Expand Down

0 comments on commit d22d366

Please sign in to comment.