Search in sources :

Example 6 with CompilerControl

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

the class Utf8EncodingBenchmark method writeGetBytes.

@Benchmark
@CompilerControl(Mode.DONT_INLINE)
public int writeGetBytes() throws UnsupportedEncodingException {
    int countBytes = 0;
    for (String string : strings) {
        buffer.resetWriterIndex();
        final byte[] bytes = string.getBytes("UTF-8");
        buffer.writeBytes(bytes);
        countBytes += buffer.writerIndex();
    }
    return countBytes;
}
Also used : AsciiString(io.netty.util.AsciiString) CompilerControl(org.openjdk.jmh.annotations.CompilerControl) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Example 7 with CompilerControl

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

the class SearchRealDataBenchmark method findAll.

@Benchmark
@CompilerControl(Mode.DONT_INLINE)
public void findAll(Blackhole blackHole) {
    SearchProcessor searchProcessor = searchProcessorFactory.newSearchProcessor();
    int pos = 0;
    do {
        pos = haystack.forEachByte(pos, haystackLength - pos, searchProcessor) + 1;
        blackHole.consume(pos);
    } while (pos > 0);
}
Also used : SearchProcessor(io.netty.buffer.search.SearchProcessor) CompilerControl(org.openjdk.jmh.annotations.CompilerControl) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Aggregations

Benchmark (org.openjdk.jmh.annotations.Benchmark)7 CompilerControl (org.openjdk.jmh.annotations.CompilerControl)7 AsciiString (io.netty.util.AsciiString)6 SearchProcessor (io.netty.buffer.search.SearchProcessor)1