This commit is contained in:
Richard Artoul 2018-11-28 21:34:44 -05:00
parent e8e4369f76
commit 339a78d88d
2 changed files with 18 additions and 18 deletions

View file

@ -407,9 +407,6 @@ func (b *Bitmap) Union(others ...*Bitmap) *Bitmap {
// b in place.
func (b *Bitmap) UnionInPlace(others ...*Bitmap) {
b.unionIntoTarget(b, others...)
// for _, other := range others {
// b.unionIntoTarget(other, b)
// }
}
type wrapperIter struct {
@ -504,12 +501,15 @@ func (b *Bitmap) unionIntoTarget(target *Bitmap, others ...*Bitmap) {
// }
// else {
// Use a bitmap
buf := make([]uint64, bitmapN)
ob := buf[:bitmapN]
container := &Container{
bitmap: ob,
n: 0,
containerType: containerBitmap,
container := target.Containers.Get(iKey)
if container == nil {
buf := make([]uint64, bitmapN)
ob := buf[:bitmapN]
container = &Container{
bitmap: ob,
n: 0,
containerType: containerBitmap,
}
}
for _, jIter := range otherIters {

View file

@ -1424,12 +1424,12 @@ func BenchmarkUnion(b *testing.B) {
}
}
// func BenchmarkUnionBulk(b *testing.B) {
// // a1, a2, b, r1, r2 *roaring.Bitmap
// data := getBenchData(b)
// yolo := roaring.NewBitmap()
// for n := 0; n < b.N; n++ {
// yolo.
// BulkUnion(data.a1, data.a2, data.b, data.r1, data.r2)
// }
// }
func BenchmarkUnionBulk(b *testing.B) {
// a1, a2, b, r1, r2 *roaring.Bitmap
data := getBenchData(b)
yolo := roaring.NewBitmap()
for n := 0; n < b.N; n++ {
yolo.
UnionInPlace(data.a1, data.a2, data.b, data.r1, data.r2)
}
}