Search in sources :

Example 71 with Setup

use of org.openjdk.jmh.annotations.Setup in project netty by netty.

the class HeadersBenchmark method setup.

@Setup(Level.Trial)
public void setup() {
    Map<String, String> headers = ExampleHeaders.EXAMPLES.get(exampleHeader);
    httpNames = new AsciiString[headers.size()];
    http2Names = new AsciiString[headers.size()];
    httpValues = new AsciiString[headers.size()];
    httpHeaders = new DefaultHttpHeaders(false);
    http2Headers = new DefaultHttp2Headers(false);
    int idx = 0;
    for (Map.Entry<String, String> header : headers.entrySet()) {
        String name = header.getKey();
        String httpName = toHttpName(name);
        String http2Name = toHttp2Name(name);
        String value = header.getValue();
        httpNames[idx] = new AsciiString(httpName);
        http2Names[idx] = new AsciiString(http2Name);
        httpValues[idx] = new AsciiString(value);
        httpHeaders.add(httpNames[idx], httpValues[idx]);
        http2Headers.add(http2Names[idx], httpValues[idx]);
        idx++;
    }
    slowHttp2Headers = new SlowHeaders(http2Headers);
    emptyHttpHeaders = new DefaultHttpHeaders(true);
    emptyHttp2Headers = new DefaultHttp2Headers(true);
    emptyHttpHeadersNoValidate = new DefaultHttpHeaders(false);
    emptyHttp2HeadersNoValidate = new DefaultHttp2Headers(false);
}
Also used : DefaultHttpHeaders(io.netty.handler.codec.http.DefaultHttpHeaders) DefaultHttp2Headers(io.netty.handler.codec.http2.DefaultHttp2Headers) AsciiString(io.netty.util.AsciiString) AsciiString(io.netty.util.AsciiString) Map(java.util.Map) Setup(org.openjdk.jmh.annotations.Setup)

Example 72 with Setup

use of org.openjdk.jmh.annotations.Setup in project netty by netty.

the class ReadOnlyHttp2HeadersBenchmark method setUp.

@Setup
public void setUp() throws Exception {
    headerNames = new AsciiString[headerCount];
    headerValues = new AsciiString[headerCount];
    for (int i = 0; i < headerCount; ++i) {
        headerNames[i] = new AsciiString("key-" + i);
        headerValues[i] = new AsciiString(UUID.randomUUID().toString());
    }
}
Also used : AsciiString(io.netty.util.AsciiString) Setup(org.openjdk.jmh.annotations.Setup)

Example 73 with Setup

use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.

the class MemoryHandlerJULLocationBenchmark method up.

@Setup(Level.Trial)
public void up() {
    memoryHandler = new MemoryHandler(new NoOpJULHandler(), 262144, java.util.logging.Level.SEVERE);
    logger = Logger.getLogger(getClass().getName());
    logger.setUseParentHandlers(false);
    logger.addHandler(memoryHandler);
    logger.setLevel(java.util.logging.Level.ALL);
}
Also used : MemoryHandler(java.util.logging.MemoryHandler) NoOpJULHandler(org.apache.logging.log4j.perf.util.NoOpJULHandler) Setup(org.openjdk.jmh.annotations.Setup)

Example 74 with Setup

use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.

the class SortedArrayVsHashMapBenchmark method setup.

@Setup
public void setup() {
    openHashMapContextData = new OpenHashStringMap<>();
    sortedStringArrayMap = new SortedArrayStringMap();
    map = new HashMap<>();
    keys = new String[count];
    final Random r = new Random();
    for (int j = 0; j < keys.length; j++) {
        final char[] str = new char[length];
        for (int i = 0; i < str.length; i++) {
            str[i] = (char) r.nextInt();
        }
        keys[j] = new String(str);
    }
    populatedMap = new HashMap<>();
    for (int i = 0; i < count; i++) {
        populatedMap.put(keys[i], value);
    }
    populatedSortedStringArrayMap = new SortedArrayStringMap();
    for (int i = 0; i < count; i++) {
        populatedSortedStringArrayMap.putValue(keys[i], value);
    }
    populatedOpenHashContextData = new OpenHashStringMap<>();
    for (int i = 0; i < count; i++) {
        populatedOpenHashContextData.putValue(keys[i], value);
    }
}
Also used : Random(java.util.Random) SortedArrayStringMap(org.apache.logging.log4j.util.SortedArrayStringMap) Setup(org.openjdk.jmh.annotations.Setup)

Example 75 with Setup

use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.

the class FileAppenderBenchmark method setUp.

@Setup
public void setUp() throws Exception {
    System.setProperty("log4j.configurationFile", "log4j2-perf.xml");
    System.setProperty("log4j.configuration", "log4j12-perf.xml");
    System.setProperty("logback.configurationFile", "logback-perf.xml");
    deleteLogFiles();
    log4j2Logger = LogManager.getLogger(FileAppenderBenchmark.class);
    log4j2AsyncAppender = LogManager.getLogger("AsyncAppender");
    log4j2AsyncDisruptor = LogManager.getLogger("AsyncDisruptorAppender");
    log4j2AsyncLogger = LogManager.getLogger("AsyncLogger");
    log4j2MemoryLogger = LogManager.getLogger("MemoryMapped");
    log4j2RandomLogger = LogManager.getLogger("TestRandom");
    slf4jLogger = LoggerFactory.getLogger(FileAppenderBenchmark.class);
    slf4jAsyncLogger = LoggerFactory.getLogger("Async");
    log4j1Logger = org.apache.log4j.Logger.getLogger(FileAppenderBenchmark.class);
    julFileHandler = new FileHandler("target/testJulLog.log");
    julLogger = java.util.logging.Logger.getLogger(getClass().getName());
    julLogger.setUseParentHandlers(false);
    julLogger.addHandler(julFileHandler);
    julLogger.setLevel(Level.ALL);
}
Also used : FileHandler(java.util.logging.FileHandler) Setup(org.openjdk.jmh.annotations.Setup)

Aggregations

Setup (org.openjdk.jmh.annotations.Setup)88 File (java.io.File)19 InputRow (io.druid.data.input.InputRow)15 BenchmarkDataGenerator (io.druid.benchmark.datagen.BenchmarkDataGenerator)14 HyperUniquesSerde (io.druid.query.aggregation.hyperloglog.HyperUniquesSerde)14 Random (java.util.Random)11 IndexSpec (io.druid.segment.IndexSpec)10 IncrementalIndex (io.druid.segment.incremental.IncrementalIndex)8 OnheapIncrementalIndex (io.druid.segment.incremental.OnheapIncrementalIndex)8 QueryableIndex (io.druid.segment.QueryableIndex)7 ByteBuffer (java.nio.ByteBuffer)7 StupidPool (io.druid.collections.StupidPool)4 OffheapBufferGenerator (io.druid.offheap.OffheapBufferGenerator)4 PooledByteBufAllocator (io.netty.buffer.PooledByteBufAllocator)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 AtomicLong (java.util.concurrent.atomic.AtomicLong)4 Function (com.google.common.base.Function)3 BitmapFactory (io.druid.collections.bitmap.BitmapFactory)3 ImmutableBitmap (io.druid.collections.bitmap.ImmutableBitmap)3 MutableBitmap (io.druid.collections.bitmap.MutableBitmap)3