Add a test for allocations in undirtiedChunksIter.Iter

This commit is contained in:
Matt Joiner 2022-05-09 11:10:57 +10:00
parent 3a3307632a
commit 9b9a37eee6
No known key found for this signature in database
GPG Key ID: 6B990B8185E7F782
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
package torrent
import (
"testing"
"github.com/RoaringBitmap/roaring"
)
func BenchmarkUndirtiedChunksIter(b *testing.B) {
var bitmap roaring.Bitmap
a := undirtiedChunksIter{
TorrentDirtyChunks: &bitmap,
StartRequestIndex: 69,
EndRequestIndex: 420,
}
b.ReportAllocs()
for i := 0; i < b.N; i++ {
a.Iter(func(chunkIndex chunkIndexType) {
})
}
}