use of org.roaringbitmap.buffer.MutableRoaringBitmap in project druid by druid-io.
the class RangeBitmapBenchmarkTest method prepareRandomRanges.
@BeforeClass
public static void prepareRandomRanges() throws Exception {
System.setProperty("jub.customkey", String.format("%06.5f", DENSITY));
reset();
final BitSet expectedUnion = new BitSet();
for (int i = 0; i < SIZE; ++i) {
ConciseSet c = new ConciseSet();
MutableRoaringBitmap r = new MutableRoaringBitmap();
{
int k = 0;
boolean fill = true;
while (k < LENGTH) {
int runLength = (int) (LENGTH * DENSITY) + rand.nextInt((int) (LENGTH * DENSITY));
for (int j = k; fill && j < LENGTH && j < k + runLength; ++j) {
c.add(j);
r.add(j);
expectedUnion.set(j);
}
k += runLength;
fill = !fill;
}
}
minIntersection = MIN_INTERSECT;
for (int k = LENGTH / 2; k < LENGTH / 2 + minIntersection; ++k) {
c.add(k);
r.add(k);
expectedUnion.set(k);
}
concise[i] = ImmutableConciseSet.newImmutableFromMutable(c);
offheapConcise[i] = makeOffheapConcise(concise[i]);
roaring[i] = r;
immutableRoaring[i] = makeImmutableRoaring(r);
offheapRoaring[i] = makeOffheapRoaring(r);
genericConcise[i] = new WrappedImmutableConciseBitmap(offheapConcise[i]);
genericRoaring[i] = new WrappedImmutableRoaringBitmap(offheapRoaring[i]);
}
unionCount = expectedUnion.cardinality();
printSizeStats(DENSITY, "Random Alternating Bitmap");
}
use of org.roaringbitmap.buffer.MutableRoaringBitmap in project druid by druid-io.
the class UniformBitmapBenchmarkTest method prepareMostlyUniform.
@BeforeClass
public static void prepareMostlyUniform() throws Exception {
System.setProperty("jub.customkey", String.format("%05.4f", DENSITY));
reset();
final BitSet expectedUnion = new BitSet();
final int[] knownTrue = new int[MIN_INTERSECT];
for (int i = 0; i < knownTrue.length; ++i) {
knownTrue[i] = rand.nextInt(LENGTH);
}
for (int i = 0; i < SIZE; ++i) {
ConciseSet c = new ConciseSet();
MutableRoaringBitmap r = new MutableRoaringBitmap();
for (int k = 0; k < LENGTH; ++k) {
if (rand.nextDouble() < DENSITY) {
c.add(k);
r.add(k);
expectedUnion.set(k);
}
}
for (int k : knownTrue) {
c.add(k);
r.add(k);
expectedUnion.set(k);
}
concise[i] = ImmutableConciseSet.newImmutableFromMutable(c);
offheapConcise[i] = makeOffheapConcise(concise[i]);
roaring[i] = r;
immutableRoaring[i] = makeImmutableRoaring(r);
offheapRoaring[i] = makeOffheapRoaring(r);
genericConcise[i] = new WrappedImmutableConciseBitmap(offheapConcise[i]);
genericRoaring[i] = new WrappedImmutableRoaringBitmap(offheapRoaring[i]);
}
unionCount = expectedUnion.cardinality();
minIntersection = knownTrue.length;
printSizeStats(DENSITY, "Uniform Bitmap");
}
use of org.roaringbitmap.buffer.MutableRoaringBitmap in project druid by druid-io.
the class WrappedRoaringBitmap method or.
@Override
public void or(MutableBitmap mutableBitmap) {
WrappedRoaringBitmap other = (WrappedRoaringBitmap) mutableBitmap;
MutableRoaringBitmap unwrappedOtherBitmap = other.bitmap;
bitmap.or(unwrappedOtherBitmap);
}
use of org.roaringbitmap.buffer.MutableRoaringBitmap in project druid by druid-io.
the class WrappedRoaringBitmap method intersection.
@Override
public ImmutableBitmap intersection(ImmutableBitmap otherBitmap) {
WrappedRoaringBitmap other = (WrappedRoaringBitmap) otherBitmap;
MutableRoaringBitmap unwrappedOtherBitmap = other.bitmap;
return new WrappedImmutableRoaringBitmap(MutableRoaringBitmap.and(bitmap, unwrappedOtherBitmap));
}
use of org.roaringbitmap.buffer.MutableRoaringBitmap in project druid by druid-io.
the class WrappedRoaringBitmap method xor.
@Override
public void xor(MutableBitmap mutableBitmap) {
WrappedRoaringBitmap other = (WrappedRoaringBitmap) mutableBitmap;
MutableRoaringBitmap unwrappedOtherBitmap = other.bitmap;
bitmap.xor(unwrappedOtherBitmap);
}
Aggregations