mirror of https://github.com/apache/druid.git
Add deserialization benchmark to BitmapCreationBenchmark
This commit is contained in:
parent
483b2c7be0
commit
648759e9f6
|
@ -33,6 +33,7 @@ import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -104,6 +105,7 @@ public class BitmapCreationBenchmark extends AbstractBenchmark
|
||||||
ImmutableBitmap baseImmutableBitmap;
|
ImmutableBitmap baseImmutableBitmap;
|
||||||
MutableBitmap baseMutableBitmap;
|
MutableBitmap baseMutableBitmap;
|
||||||
byte[] baseBytes;
|
byte[] baseBytes;
|
||||||
|
ByteBuffer baseByteBuffer;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup()
|
public void setup()
|
||||||
|
@ -114,6 +116,7 @@ public class BitmapCreationBenchmark extends AbstractBenchmark
|
||||||
}
|
}
|
||||||
baseImmutableBitmap = factory.makeImmutableBitmap(baseMutableBitmap);
|
baseImmutableBitmap = factory.makeImmutableBitmap(baseMutableBitmap);
|
||||||
baseBytes = baseImmutableBitmap.toBytes();
|
baseBytes = baseImmutableBitmap.toBytes();
|
||||||
|
baseByteBuffer = ByteBuffer.wrap(baseBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -159,4 +162,13 @@ public class BitmapCreationBenchmark extends AbstractBenchmark
|
||||||
Assert.assertArrayEquals(baseBytes, immutableBitmap.toBytes());
|
Assert.assertArrayEquals(baseBytes, immutableBitmap.toBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@BenchmarkOptions(warmupRounds = 10, benchmarkRounds = 1000)
|
||||||
|
@Test
|
||||||
|
public void testFromImmutableByteArray()
|
||||||
|
{
|
||||||
|
ImmutableBitmap immutableBitmap = factory.mapImmutableBitmap(baseByteBuffer);
|
||||||
|
Assert.assertEquals(numBits, immutableBitmap.size());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue