mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
simplify intersectBitmapRun output to remove a conversion
If the total number of things returned was small enough to make an array, intersectBitmapRun converted to an array. This seems possibly-premature; future processing might well prefer a bitmap. We know everything gets optimized before being written out, let's not convert without a specific reason. But also, let's use an array no matter which container is small enough to prove that we can do so safely. Fixes #854.
This commit is contained in:
parent
c8e6fd2e43
commit
32c4b3540f
1 changed files with 3 additions and 6 deletions
|
|
@ -2102,12 +2102,12 @@ func intersectRunRun(a, b *Container) *Container {
|
|||
return output
|
||||
}
|
||||
|
||||
// intersectBitmapRun returns an array container if the run container's
|
||||
// cardinality is < ArrayMaxSize. Otherwise it returns a bitmap container.
|
||||
// intersectBitmapRun returns an array container if either container's
|
||||
// cardinality is <= ArrayMaxSize. Otherwise it returns a bitmap container.
|
||||
func intersectBitmapRun(a, b *Container) *Container {
|
||||
statsHit("intersect/BitmapRun")
|
||||
var output *Container
|
||||
if b.n < ArrayMaxSize {
|
||||
if b.n <= ArrayMaxSize || a.n <= ArrayMaxSize {
|
||||
// output is array container
|
||||
output = &Container{containerType: containerArray}
|
||||
for _, iv := range b.runs {
|
||||
|
|
@ -2161,9 +2161,6 @@ func intersectBitmapRun(a, b *Container) *Container {
|
|||
valast = vastart + 63
|
||||
}
|
||||
}
|
||||
if output.n < ArrayMaxSize {
|
||||
output.bitmapToArray()
|
||||
}
|
||||
}
|
||||
return output
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue