use of org.openjdk.jmh.annotations.Benchmark in project netty by netty.
the class ReadOnlyHttp2HeadersBenchmark method defaultServerHeaders.
@Benchmark
@BenchmarkMode(Mode.AverageTime)
public int defaultServerHeaders() {
Http2Headers headers = new DefaultHttp2Headers(false);
for (int i = 0; i < headerCount; ++i) {
headers.add(headerNames[i], headerValues[i]);
}
headers.status(HttpResponseStatus.OK.codeAsText());
return iterate(headers);
}
use of org.openjdk.jmh.annotations.Benchmark in project netty by netty.
the class ByteBufAllocatorBenchmark method unpooledHeapAllocAndFree.
@Benchmark
public void unpooledHeapAllocAndFree() {
int idx = rand.nextInt(unpooledHeapBuffers.length);
ByteBuf oldBuf = unpooledHeapBuffers[idx];
if (oldBuf != null) {
oldBuf.release();
}
unpooledHeapBuffers[idx] = unpooledAllocator.heapBuffer(size);
}
use of org.openjdk.jmh.annotations.Benchmark in project netty by netty.
the class ByteBufAllocatorBenchmark method pooledDirectAllocAndFree.
@Benchmark
public void pooledDirectAllocAndFree() {
int idx = rand.nextInt(pooledDirectBuffers.length);
ByteBuf oldBuf = pooledDirectBuffers[idx];
if (oldBuf != null) {
oldBuf.release();
}
pooledDirectBuffers[idx] = pooledAllocator.directBuffer(size);
}
use of org.openjdk.jmh.annotations.Benchmark in project netty by netty.
the class ByteBufAllocatorBenchmark method unpooledDirectAllocAndFree.
@Benchmark
public void unpooledDirectAllocAndFree() {
int idx = rand.nextInt(unpooledDirectBuffers.length);
ByteBuf oldBuf = unpooledDirectBuffers[idx];
if (oldBuf != null) {
oldBuf.release();
}
unpooledDirectBuffers[idx] = unpooledAllocator.directBuffer(size);
}
use of org.openjdk.jmh.annotations.Benchmark in project netty by netty.
the class ByteBufAllocatorBenchmark method defaultPooledHeapAllocAndFree.
@Benchmark
public void defaultPooledHeapAllocAndFree() {
int idx = rand.nextInt(defaultPooledHeapBuffers.length);
ByteBuf oldBuf = defaultPooledHeapBuffers[idx];
if (oldBuf != null) {
oldBuf.release();
}
defaultPooledHeapBuffers[idx] = PooledByteBufAllocator.DEFAULT.heapBuffer(size);
}
Aggregations