2
0
mirror of synced 2025-02-23 06:08:07 +00:00
torrent/undirtied-chunks-iter_test.go

20 lines
533 B
Go
Raw Normal View History

package torrent
import (
"testing"
2022-05-09 11:34:08 +10:00
typedRoaring "github.com/anacrolix/torrent/typed-roaring"
)
2022-05-11 11:20:52 +10:00
func BenchmarkIterUndirtiedRequestIndexesInPiece(b *testing.B) {
2022-05-09 11:34:08 +10:00
var bitmap typedRoaring.Bitmap[RequestIndex]
2022-05-11 11:20:52 +10:00
it := bitmap.IteratorType()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
2022-05-11 11:20:52 +10:00
// This is the worst case, when Torrent.iterUndirtiedRequestIndexesInPiece can't find a
// usable cached iterator. This should be the only allocation.
it.Initialize(&bitmap)
iterBitmapUnsetInRange(&it, 69, 420, func(RequestIndex) {})
}
}