File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -971,23 +971,18 @@ func ClearBits(foundSet, target *Bitmap) {
971971 target .AndNot (foundSet )
972972}
973973
974- // ClearValues removes the values found in foundSet
974+ // ClearValues removes from the BSI all values whose column IDs are in
975+ // foundSet, modifying the BSI in place.
976+ //
977+ // The implementation is intentionally serial. A previous goroutine-per-bit-plane
978+ // approach was slower in practice: goroutine creation overhead dominated for
979+ // typical BSI sizes, and the cost compounds when ClearValues is called in a
980+ // tight loop (e.g. once per term across an entire index during a deletion pass).
975981func (b * BSI ) ClearValues (foundSet * Bitmap ) {
976-
977- var wg sync.WaitGroup
978- wg .Add (1 )
979- go func () {
980- defer wg .Done ()
981- b .eBM .AndNot (foundSet )
982- }()
983- for i := 0 ; i < b .BitCount (); i ++ {
984- wg .Add (1 )
985- go func (j int ) {
986- defer wg .Done ()
987- b .bA [j ].AndNot (foundSet )
988- }(i )
982+ b .eBM .AndNot (foundSet )
983+ for i := range b .bA {
984+ b .bA [i ].AndNot (foundSet )
989985 }
990- wg .Wait ()
991986}
992987
993988// NewBSIRetainSet - Construct a new BSI from a clone of existing BSI, retain only values contained in foundSet
You can’t perform that action at this time.
0 commit comments