mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
use num containers to decide which direction to union
avoids doing a potentially expensive f.storage.Count()
This commit is contained in:
parent
e33ca2d0ae
commit
19807ff3a7
1 changed files with 4 additions and 8 deletions
12
fragment.go
12
fragment.go
|
|
@ -1750,15 +1750,11 @@ func (f *fragment) importRoaring(data []byte, clear bool) error {
|
|||
|
||||
if clear {
|
||||
bm = f.storage.Difference(bm)
|
||||
} else if f.storage.Containers.Size() >= bm.Containers.Size() {
|
||||
f.storage.UnionInPlace(bm)
|
||||
bm = f.storage
|
||||
} else {
|
||||
if cnt := f.storage.Count(); cnt > 0 {
|
||||
if incomingCnt > int(cnt) {
|
||||
bm.UnionInPlace(f.storage)
|
||||
} else {
|
||||
f.storage.UnionInPlace(bm)
|
||||
bm = f.storage
|
||||
}
|
||||
}
|
||||
bm.UnionInPlace(f.storage)
|
||||
}
|
||||
|
||||
for _, rowID := range rowSet {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue