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

Function BenchmarkArrayUnionThreshold

roaring_test.go:3820–3847  ·  view source on GitHub ↗

BenchmarkArrayIorMergeThreshold tests performance when unioning two array containers when the cardinality sum is over 4096

(b *testing.B)

Source from the content-addressed store, hash-verified

3818// BenchmarkArrayIorMergeThreshold tests performance
3819// when unioning two array containers when the cardinality sum is over 4096
3820func BenchmarkArrayUnionThreshold(b *testing.B) {
3821 testOddPoint := map[string]int{
3822 "mostly-overlap": 4900,
3823 "little-overlap": 2000,
3824 "no-overlap": 0,
3825 }
3826 for name, oddPoint := range testOddPoint {
3827 b.Run(name, func(b *testing.B) {
3828 left := NewBitmap()
3829 right := NewBitmap()
3830 for i := 0; i < 5000; i++ {
3831 if i%2 == 0 {
3832 left.Add(uint32(i))
3833 }
3834 if i%2 == 0 && i < oddPoint {
3835 right.Add(uint32(i))
3836 } else if i%2 == 1 && i >= oddPoint {
3837 right.Add(uint32(i))
3838 }
3839 }
3840 b.ResetTimer()
3841 b.ReportAllocs()
3842 for i := 0; i < b.N; i++ {
3843 right.Clone().Or(left)
3844 }
3845 })
3846 }
3847}
3848
3849func TestIssue467CaseSmall(t *testing.T) {
3850 b := New()

Callers

nothing calls this directly

Calls 4

AddMethod · 0.95
CloneMethod · 0.95
NewBitmapFunction · 0.70
OrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…