Search in sources :

Example 11 with BenchmarkOptions

use of com.carrotsearch.junitbenchmarks.BenchmarkOptions in project druid by druid-io.

the class BitmapCreationBenchmark method testLinearAddition.

@BenchmarkOptions(warmupRounds = 10, benchmarkRounds = 1000)
@Test
public void testLinearAddition() {
    MutableBitmap mutableBitmap = factory.makeEmptyMutableBitmap();
    for (int i = 0; i < NUM_BITS; ++i) {
        mutableBitmap.add(i);
    }
    Assert.assertEquals(NUM_BITS, mutableBitmap.size());
}
Also used : MutableBitmap(org.apache.druid.collections.bitmap.MutableBitmap) Test(org.junit.Test) BenchmarkOptions(com.carrotsearch.junitbenchmarks.BenchmarkOptions)

Example 12 with BenchmarkOptions

use of com.carrotsearch.junitbenchmarks.BenchmarkOptions in project druid by druid-io.

the class BitmapCreationBenchmark method testFromImmutableByteArray.

@BenchmarkOptions(warmupRounds = 10, benchmarkRounds = 1000)
@Test
public void testFromImmutableByteArray() {
    ImmutableBitmap immutableBitmap = factory.mapImmutableBitmap(baseByteBuffer);
    Assert.assertEquals(NUM_BITS, immutableBitmap.size());
}
Also used : ImmutableBitmap(org.apache.druid.collections.bitmap.ImmutableBitmap) Test(org.junit.Test) BenchmarkOptions(com.carrotsearch.junitbenchmarks.BenchmarkOptions)

Example 13 with BenchmarkOptions

use of com.carrotsearch.junitbenchmarks.BenchmarkOptions in project DirectMemory by raffaeleguidi.

the class TestCachePlusSerialization method basicBench.

@BenchmarkOptions(benchmarkRounds = 50000, warmupRounds = 0, concurrency = 1)
@Test
public void basicBench() {
    DummyPojo d = new DummyPojo("test-" + rnd.nextInt(100000), 1024 + rnd.nextInt(1024));
    Cache.put(d.name, d);
    DummyPojo d2 = (DummyPojo) Cache.retrieve(d.name);
    assertEquals(d.name, d2.name);
}
Also used : DummyPojo(org.directmemory.misc.DummyPojo) Test(org.junit.Test) BenchmarkOptions(com.carrotsearch.junitbenchmarks.BenchmarkOptions)

Example 14 with BenchmarkOptions

use of com.carrotsearch.junitbenchmarks.BenchmarkOptions in project DirectMemory by raffaeleguidi.

the class ConcurrentTests method retrieveCatchThemAll.

@BenchmarkOptions(benchmarkRounds = 1000000, warmupRounds = 0, concurrency = 100)
@Test
public void retrieveCatchThemAll() {
    String key = "test-" + (rndGen.nextInt(entries) + 1);
    Pointer p = map.get(key);
    read.incrementAndGet();
    if (p != null) {
        got.incrementAndGet();
        byte[] payload = mem.retrieve(p);
        if (key.equals(new String(payload)))
            good.incrementAndGet();
        else
            bad.incrementAndGet();
    } else {
        logger.info("did not find key " + key);
        missed.incrementAndGet();
    }
}
Also used : Pointer(org.directmemory.memory.Pointer) Test(org.junit.Test) BenchmarkOptions(com.carrotsearch.junitbenchmarks.BenchmarkOptions)

Example 15 with BenchmarkOptions

use of com.carrotsearch.junitbenchmarks.BenchmarkOptions in project DirectMemory by raffaeleguidi.

the class PreliminarBenchmarks method testAllocation.

@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0)
@Test
public void testAllocation() {
    logger.info("payload is " + payload.length + " bytes");
    logger.info("allocating " + Ram.inMb(payload.length * 200000));
    ByteBuffer buf = ByteBuffer.allocateDirect(payload.length * 200000);
    assertNotNull(buf);
    logger.info("done");
}
Also used : ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test) BenchmarkOptions(com.carrotsearch.junitbenchmarks.BenchmarkOptions)

Aggregations

BenchmarkOptions (com.carrotsearch.junitbenchmarks.BenchmarkOptions)42 Test (org.junit.Test)42 DirectByteBufferAllocator (org.apache.parquet.bytes.DirectByteBufferAllocator)10 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)6 ListeningExecutorService (com.google.common.util.concurrent.ListeningExecutorService)6 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)6 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)6 ByteBufferInputStream (org.apache.parquet.bytes.ByteBufferInputStream)6 Binary (org.apache.parquet.io.api.Binary)6 Ignore (org.junit.Ignore)6 ArrayList (java.util.ArrayList)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 Pointer (org.directmemory.memory.Pointer)4 BasicDBObject (com.mongodb.BasicDBObject)3 MutableBitmap (io.druid.collections.bitmap.MutableBitmap)3 LinkedList (java.util.LinkedList)3 MutableBitmap (org.apache.druid.collections.bitmap.MutableBitmap)3 DeltaBinaryPackingValuesWriter (org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesWriter)3 BinaryPlainValuesReader (org.apache.parquet.column.values.plain.BinaryPlainValuesReader)3 PlainValuesWriter (org.apache.parquet.column.values.plain.PlainValuesWriter)3