MCPcopy
hub / github.com/RoaringBitmap/roaring / BenchmarkInPlaceArrayUnions

Function BenchmarkInPlaceArrayUnions

roaring_test.go:3756–3775  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

3754}
3755
3756func BenchmarkInPlaceArrayUnions(b *testing.B) {
3757 rand.Seed(100)
3758 b.ReportAllocs()
3759 componentBitmaps := make([]*Bitmap, 100)
3760 for i := 0; i < 100; i++ {
3761 bitmap := NewBitmap()
3762 for j := 0; j < 100; j++ {
3763 // keep all entries in [0,4096), so they stay arrays.
3764 bitmap.Add(uint32(rand.Intn(arrayDefaultMaxSize)))
3765 }
3766 componentBitmaps[i] = bitmap
3767 }
3768 b.ResetTimer()
3769 for i := 0; i < b.N; i++ {
3770 bitmap := NewBitmap()
3771 for j := 0; j < 100; j++ {
3772 bitmap.Or(componentBitmaps[rand.Intn(100)])
3773 }
3774 }
3775}
3776
3777func BenchmarkAntagonisticArrayUnionsGrowth(b *testing.B) {
3778 left := NewBitmap()

Callers

nothing calls this directly

Calls 3

AddMethod · 0.95
OrMethod · 0.95
NewBitmapFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…