]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Add a test for allocations in undirtiedChunksIter.Iter
authorMatt Joiner <anacrolix@gmail.com>
Mon, 9 May 2022 01:10:57 +0000 (11:10 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 9 May 2022 02:05:12 +0000 (12:05 +1000)
undirtied-chunks-iter_test.go [new file with mode: 0644]

diff --git a/undirtied-chunks-iter_test.go b/undirtied-chunks-iter_test.go
new file mode 100644 (file)
index 0000000..d9b12df
--- /dev/null
@@ -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) {
+
+               })
+       }
+}