Skip to content

Commit

Permalink
warmup effect was maybe runtime opt that sped up big mallocs (see Mal…
Browse files Browse the repository at this point in the history
…locWarmup). note: there may be bug in benchmark lib. supposed to GC bw runs. that might not be happening (see MallocUnstable).
  • Loading branch information
sanjit-bhat committed Jan 15, 2025
1 parent ec31aa7 commit b854746
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions merkle/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,19 @@ func BenchmarkGetProofSome(b *testing.B) {
tr.ctx.getProof(tr.root, label)
}
}

func BenchmarkMallocUnstable(b *testing.B) {
proofs := make([][]byte, 0, 1_000_000)
for range b.N {
proof := make([]byte, 0, cryptoffi.HashLen*hashesPerProofDepth)
proofs = append(proofs, proof)
}
}

func BenchmarkMallocWarmup(b *testing.B) {
var proof []byte
for range b.N {
proof = make([]byte, 0, cryptoffi.HashLen*hashesPerProofDepth)
proof = append(proof, 1)
}
}

0 comments on commit b854746

Please sign in to comment.