From 9b9a37eee62e05b78496f2a3f64484016931692b Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 9 May 2022 11:10:57 +1000 Subject: [PATCH] Add a test for allocations in undirtiedChunksIter.Iter --- undirtied-chunks-iter_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 undirtied-chunks-iter_test.go 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) { + + }) + } +} -- 2.44.0