Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions roaring64/bsi64.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,23 +971,18 @@ func ClearBits(foundSet, target *Bitmap) {
target.AndNot(foundSet)
}

// ClearValues removes the values found in foundSet
// ClearValues removes from the BSI all values whose column IDs are in
// foundSet, modifying the BSI in place.
//
// The implementation is intentionally serial. A previous goroutine-per-bit-plane
// approach was slower in practice: goroutine creation overhead dominated for
// typical BSI sizes, and the cost compounds when ClearValues is called in a
// tight loop (e.g. once per term across an entire index during a deletion pass).
func (b *BSI) ClearValues(foundSet *Bitmap) {

var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
b.eBM.AndNot(foundSet)
}()
for i := 0; i < b.BitCount(); i++ {
wg.Add(1)
go func(j int) {
defer wg.Done()
b.bA[j].AndNot(foundSet)
}(i)
b.eBM.AndNot(foundSet)
for i := range b.bA {
b.bA[i].AndNot(foundSet)
}
wg.Wait()
}

// NewBSIRetainSet - Construct a new BSI from a clone of existing BSI, retain only values contained in foundSet
Expand Down
Loading