Java Code Examples for org.roaringbitmap.buffer.MutableRoaringBitmap#getCardinality()

The following examples show how to use org.roaringbitmap.buffer.MutableRoaringBitmap#getCardinality() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MappedRunContainerRealDataBenchmarkRunOptimize.java    From RoaringBitmap with Apache License 2.0 5 votes vote down vote up
@Benchmark
public int mutable_clone(BenchmarkState benchmarkState) {
  int total = 0;
  for (int i = 0; i < benchmarkState.mac.size(); i++) {
    MutableRoaringBitmap bitmap = benchmarkState.mac.get(i).clone();
    total += bitmap.getCardinality();
  }
  return total;
}
 
Example 2
Source File: MappedRunContainerRealDataBenchmarkRunOptimize.java    From RoaringBitmap with Apache License 2.0 5 votes vote down vote up
@Benchmark
public int mutable_cloneAndrunOptimize(BenchmarkState benchmarkState) {
  int total = 0;
  for (int i = 0; i < benchmarkState.mac.size(); i++) {
    MutableRoaringBitmap bitmap = benchmarkState.mac.get(i).clone();
    bitmap.runOptimize();
    total += bitmap.getCardinality();
  }
  return total;
}
 
Example 3
Source File: BasicBenchmark.java    From RoaringBitmap with Apache License 2.0 5 votes vote down vote up
@Benchmark
public int bigunion_mutable(MutableState state) {
  int bogus = 0;

  for (int k = 1, i = 0; k < state.N; k += 10, i++) {
    MutableRoaringBitmap bitmapor = BufferFastAggregation.horizontal_or(state.ors_mutable.get(i));
    bogus += bitmapor.getCardinality();
  }

  return bogus;
}
 
Example 4
Source File: BasicBenchmark.java    From RoaringBitmap with Apache License 2.0 5 votes vote down vote up
@Benchmark
public int bigunion_immutable(ImmutableState state) {
  int bogus = 0;

  for (int k = 1, i = 0; k < state.N; k += 10, i++) {
    MutableRoaringBitmap bitmapor =
        BufferFastAggregation.horizontal_or(state.ors_immutable.get(i));
    bogus += bitmapor.getCardinality();
  }

  return bogus;
}