MCPcopy Create free account
hub / github.com/RoaringBitmap/roaring / FastAnd

Function FastAnd

fastaggregation.go:135–146  ·  view source on GitHub ↗

FastAnd computes the intersection between many bitmaps quickly Compared to the And function, it can take many bitmaps as input, thus saving the trouble of manually calling "And" many times. Performance hints: if you have very large and tiny bitmaps, it may be beneficial performance-wise to put a ti

(bitmaps ...*Bitmap)

Source from the content-addressed store, hash-verified

133// it may be beneficial performance-wise to put a tiny bitmap
134// in first position.
135func FastAnd(bitmaps ...*Bitmap) *Bitmap {
136 if len(bitmaps) == 0 {
137 return NewBitmap()
138 } else if len(bitmaps) == 1 {
139 return bitmaps[0].Clone()
140 }
141 answer := And(bitmaps[0], bitmaps[1])
142 for _, bm := range bitmaps[2:] {
143 answer.And(bm)
144 }
145 return answer
146}
147
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.

Callers 2

TestIssue330Function · 0.70

Calls 4

NewBitmapFunction · 0.70
AndFunction · 0.70
CloneMethod · 0.45
AndMethod · 0.45

Tested by 2

TestIssue330Function · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…