use of org.roaringbitmap.RoaringBitmap in project RoaringBitmap by RoaringBitmap.
the class RoaringBitmapBenchmark method setup.
@Setup
public void setup() {
bitmap1 = new RoaringBitmap();
bitmap2 = new RoaringBitmap();
int k = 1 << 16;
int i = 0;
for (; i < 10000; ++i) {
bitmap1.add(i * k);
}
for (; i < 10050; ++i) {
bitmap2.add(i * k);
bitmap1.add(i * k + 13);
}
for (; i < 20000; ++i) {
bitmap2.add(i * k);
}
bitmap1.add(i * k);
}
use of org.roaringbitmap.RoaringBitmap in project RoaringBitmap by RoaringBitmap.
the class RoaringBitmapBenchmark method setup.
@Setup
public void setup() {
bitmap1 = new RoaringBitmap();
bitmap2 = new RoaringBitmap();
int k = 1 << 16;
for (int i = 0; i < 10000; ++i) {
bitmap1.add(i * k);
bitmap2.add(i * k);
}
}
use of org.roaringbitmap.RoaringBitmap in project RoaringBitmap by RoaringBitmap.
the class RoaringBitmapBenchmark method setup.
@Setup
public void setup() {
bitmap1 = new RoaringBitmap();
bitmap2 = new RoaringBitmap();
int k = 1 << 16;
for (int i = 0; i < 10000; ++i) {
bitmap1.add(2 * i * k);
bitmap2.add(2 * i * k + 1);
}
}
use of org.roaringbitmap.RoaringBitmap in project RoaringBitmap by RoaringBitmap.
the class RoaringBitmapBenchmark method inplace_andNot.
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public RoaringBitmap inplace_andNot() {
RoaringBitmap b1 = bitmap1.clone();
b1.andNot(bitmap2);
return b1;
}
use of org.roaringbitmap.RoaringBitmap in project RoaringBitmap by RoaringBitmap.
the class Basic method main.
public static void main(String[] args) {
RoaringBitmap rr = RoaringBitmap.bitmapOf(1, 2, 3, 1000);
RoaringBitmap rr2 = new RoaringBitmap();
rr2.add(4000L, 4255L);
// new bitmap
RoaringBitmap rror = RoaringBitmap.or(rr, rr2);
// in-place computation
rr.or(rr2);
// true
boolean equals = rror.equals(rr);
if (!equals)
throw new RuntimeException("bug");
// number of values stored?
long cardinality = rr.getLongCardinality();
System.out.println(cardinality);
// a "forEach" is faster than this loop, but a loop is possible:
for (int i : rr) {
System.out.println(i);
}
}
Aggregations