From: Matt Joiner Date: Mon, 9 May 2022 01:10:57 +0000 (+1000) Subject: Add a test for allocations in undirtiedChunksIter.Iter X-Git-Tag: v1.43.0~21 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=9b9a37eee62e05b78496f2a3f64484016931692b;p=btrtrc.git Add a test for allocations in undirtiedChunksIter.Iter --- diff --git a/undirtied-chunks-iter_test.go b/undirtied-chunks-iter_test.go new file mode 100644 index 00000000..d9b12df4 --- /dev/null +++ b/undirtied-chunks-iter_test.go @@ -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) { + + }) + } +}