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

Function FastOr

fastaggregation.go:150–163  ·  view source on GitHub ↗

FastOr computes the union between many bitmaps quickly, as opposed to having to call Or repeatedly. It might also be faster than calling Or repeatedly.

(bitmaps ...*Bitmap)

Source from the content-addressed store, hash-verified

148// FastOr computes the union between many bitmaps quickly, as opposed to having to call Or repeatedly.
149// It might also be faster than calling Or repeatedly.
150func FastOr(bitmaps ...*Bitmap) *Bitmap {
151 if len(bitmaps) == 0 {
152 return NewBitmap()
153 } else if len(bitmaps) == 1 {
154 return bitmaps[0].Clone()
155 }
156 answer := lazyOR(bitmaps[0], bitmaps[1])
157 for _, bm := range bitmaps[2:] {
158 answer = answer.lazyOR(bm)
159 }
160 // here is where repairAfterLazy is called.
161 answer.repairAfterLazy()
162 return answer
163}
164
165// HeapOr computes the union between many bitmaps quickly using a heap.
166// It might be faster than calling Or repeatedly.

Callers 10

TestSplitter_BrokeBmFunction · 0.70
TestBitmap_FromBufferFunction · 0.70
TestIssue330Function · 0.70
BenchmarkOrsFunction · 0.70
BenchmarkAndAnyFunction · 0.70
ParOrFunction · 0.70
BenchmarkRealDataFastOrFunction · 0.70

Calls 5

lazyORFunction · 0.85
repairAfterLazyMethod · 0.80
NewBitmapFunction · 0.70
lazyORMethod · 0.65
CloneMethod · 0.45

Tested by 9

TestSplitter_BrokeBmFunction · 0.56
TestBitmap_FromBufferFunction · 0.56
TestIssue330Function · 0.56
BenchmarkOrsFunction · 0.56
BenchmarkAndAnyFunction · 0.56
BenchmarkRealDataFastOrFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…