MCPcopy Index your code
hub / github.com/RoaringBitmap/roaring / benchmarkContainerIteratorNext

Function benchmarkContainerIteratorNext

container_test.go:170–199  ·  view source on GitHub ↗
(b *testing.B, con container)

Source from the content-addressed store, hash-verified

168}
169
170func benchmarkContainerIteratorNext(b *testing.B, con container) {
171 for _, initsize := range []int{1, 650, 6500, MaxUint16} {
172 for i := 0; i < initsize; i++ {
173 con.iadd(uint16(i))
174 }
175
176 b.Run(fmt.Sprintf("init size %d shortIterator next", initsize), func(b *testing.B) {
177 b.StartTimer()
178 diff := 0
179
180 for n := 0; n < b.N; n++ {
181 i := con.getShortIterator()
182 j := 0
183
184 for i.hasNext() {
185 i.next()
186 j++
187 }
188
189 diff += j - initsize
190 }
191
192 b.StopTimer()
193
194 if diff != 0 {
195 b.Fatalf("Expected diff 0, got %d", diff)
196 }
197 })
198 }
199}
200
201func TestContainerReverseIterator(t *testing.T) {
202 content := []uint16{1, 3, 5, 7, 9}

Calls 4

iaddMethod · 0.65
getShortIteratorMethod · 0.65
hasNextMethod · 0.65
nextMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…