github.com/anacrolix/torrent@v1.61.0/undirtied-chunks-iter_test.go (about) 1 package torrent 2 3 import ( 4 "testing" 5 6 typedRoaring "github.com/anacrolix/torrent/typed-roaring" 7 ) 8 9 func BenchmarkIterUndirtiedRequestIndexesInPiece(b *testing.B) { 10 var bitmap typedRoaring.Bitmap[RequestIndex] 11 it := bitmap.IteratorType() 12 b.ReportAllocs() 13 for i := 0; i < b.N; i++ { 14 // This is the worst case, when Torrent.iterUndirtiedRequestIndexesInPiece can't find a 15 // usable cached iterator. This should be the only allocation. 16 it.Initialize(&bitmap) 17 iterBitmapUnsetInRange(&it, 69, 420, func(RequestIndex) {}) 18 } 19 }