Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:lemire/javaewah

  • Loading branch information...
commit 949b9e57acae64c5c59c126a636cec27fc1d8a61 2 parents 823dcc8 + b7467b1
@lemire authored
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/main/java/javaewah/benchmark/benchmark.java
View
16 src/main/java/javaewah/benchmark/benchmark.java
@@ -9,13 +9,13 @@
public class benchmark {
public static void main(String args[]) {
- test(100, 18, 1000);
+ test(100, 18, 10);
}
public static void test(int N, int nbr, int repeat) {
DecimalFormat df = new DecimalFormat("0.###");
ClusteredDataGenerator cdg = new ClusteredDataGenerator();
- for (int sparsity = 0; sparsity < 31 - nbr; sparsity += 1) {
+ for (int sparsity = 1; sparsity < 31 - nbr; sparsity += 1) {
long bogus = 0;
String line = "";
long bef, aft;
@@ -29,15 +29,19 @@ public static void test(int N, int nbr, int repeat) {
// building
bef = System.currentTimeMillis();
EWAHCompressedBitmap[] ewah = new EWAHCompressedBitmap[N];
+ int size = 0;
for (int r = 0; r < repeat; ++r) {
+ size = 0;
for (int k = 0; k < N; ++k) {
ewah[k] = new EWAHCompressedBitmap();
for (int x = 0; x < data[k].length; ++x) {
ewah[k].set(data[k][x]);
}
+ size += ewah[k].sizeInBytes();
}
}
aft = System.currentTimeMillis();
+ line += "\t" + size;
line += "\t" + df.format((aft - bef) / 1000.0);
// uncompressing
bef = System.currentTimeMillis();
@@ -126,14 +130,18 @@ public static void test(int N, int nbr, int repeat) {
// building
bef = System.currentTimeMillis();
EWAHCompressedBitmap32[] ewah32 = new EWAHCompressedBitmap32[N];
+ int size32 = 0;
for (int r = 0; r < repeat; ++r)
+ size32 = 0;
for (int k = 0; k < N; ++k) {
ewah32[k] = new EWAHCompressedBitmap32();
- for (int x = 0; x < data.length; ++x) {
- ewah32[k].set(x);
+ for (int x = 0; x < data[k].length; ++x) {
+ ewah32[k].set(data[k][x]);
}
+ size32 += ewah32[k].sizeInBytes();
}
aft = System.currentTimeMillis();
+ line += "\t"+ size32;
line += "\t" + df.format((aft - bef) / 1000.0);
// uncompressing
bef = System.currentTimeMillis();
Please sign in to comment.
Something went wrong with that request. Please try again.