Add comment

This commit is contained in:
Richard Artoul 2018-11-29 14:25:39 -05:00
parent c02479a5f9
commit defcb40f8c

View file

@ -599,7 +599,12 @@ func (b *Bitmap) unionIntoTarget(target *Bitmap, others ...*Bitmap) {
hasNext = otherIters.next()
}
// Repair bitmaps after the fact
// Performing the popcount() operation with every union is wasteful because
// its likely the value will be invalidated by the next union operation. As
// a result, when we're performing all our in-place unions, we don't repair
// the value of n (container cardinality), and then at the very end we perform
// a "Repair" to recalculate all the container values. That way we never popcount()
// an entire bitmap container more than once per bulk union operation.
target.Containers.Repair()
}