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)
| 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. |
| 150 | func 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. |
searching dependent graphs…