Search in sources :

Example 1 with CompilerControl

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

the class Utf8EncodingBenchmark method byteBufUtilWriteUtf8Bimorphic.

@Benchmark
@CompilerControl(Mode.DONT_INLINE)
public int byteBufUtilWriteUtf8Bimorphic() {
    int countBytes = 0;
    for (int i = 0, size = dataSetLength; i < size; i++) {
        final StringBuilder stringBuilder = stringBuilders[i];
        final String string = strings[i];
        buffer.resetWriterIndex();
        ByteBufUtil.writeUtf8(buffer, stringBuilder, 0, stringBuilder.length());
        countBytes += buffer.writerIndex();
        buffer.resetWriterIndex();
        ByteBufUtil.writeUtf8(buffer, string, 0, string.length());
        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 2 with CompilerControl

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

the class Utf8EncodingBenchmark method byteBufUtilWriteUtf8String.

@Benchmark
@CompilerControl(Mode.DONT_INLINE)
public int byteBufUtilWriteUtf8String() {
    int countBytes = 0;
    for (String string : strings) {
        buffer.resetWriterIndex();
        ByteBufUtil.writeUtf8(buffer, string, 0, string.length());
        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 3 with CompilerControl

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

the class Utf8EncodingBenchmark method byteBufUtilWriteUtf8AsciiString.

@Benchmark
@CompilerControl(Mode.DONT_INLINE)
public int byteBufUtilWriteUtf8AsciiString() {
    int countBytes = 0;
    for (int i = 0, size = dataSetLength; i < size; i++) {
        final AsciiString asciiString = asciiStrings[i];
        buffer.resetWriterIndex();
        ByteBufUtil.writeUtf8(buffer, asciiString, 0, asciiString.length());
        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 4 with CompilerControl

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

the class Utf8EncodingBenchmark method byteBufUtilWriteUtf8CommonCharSequences.

@Benchmark
@CompilerControl(Mode.DONT_INLINE)
public int byteBufUtilWriteUtf8CommonCharSequences() {
    int countBytes = 0;
    for (int i = 0, size = dataSetLength; i < size; i++) {
        final StringBuilder stringBuilder = stringBuilders[i];
        final String string = strings[i];
        final AsciiString asciiString = asciiStrings[i];
        buffer.resetWriterIndex();
        ByteBufUtil.writeUtf8(buffer, stringBuilder, 0, stringBuilder.length());
        countBytes += buffer.writerIndex();
        buffer.resetWriterIndex();
        ByteBufUtil.writeUtf8(buffer, string, 0, string.length());
        countBytes += buffer.writerIndex();
        buffer.resetWriterIndex();
        ByteBufUtil.writeUtf8(buffer, asciiString, 0, asciiString.length());
        countBytes += buffer.writerIndex();
    }
    return countBytes;
}
Also used : AsciiString(io.netty.util.AsciiString) AsciiString(io.netty.util.AsciiString) CompilerControl(org.openjdk.jmh.annotations.CompilerControl) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Example 5 with CompilerControl

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

the class Utf8EncodingBenchmark method byteBufUtilWriteUtf8Megamorphic.

@Benchmark
@CompilerControl(Mode.DONT_INLINE)
public int byteBufUtilWriteUtf8Megamorphic() {
    int countBytes = 0;
    for (int i = 0, size = dataSetLength; i < size; i++) {
        final StringBuilder stringBuilder = stringBuilders[i];
        final String string = strings[i];
        final AnotherCharSequence anotherCharSequence = anotherCharSequences[i];
        buffer.resetWriterIndex();
        ByteBufUtil.writeUtf8(buffer, stringBuilder, 0, stringBuilder.length());
        countBytes += buffer.writerIndex();
        buffer.resetWriterIndex();
        ByteBufUtil.writeUtf8(buffer, string, 0, string.length());
        countBytes += buffer.writerIndex();
        buffer.resetWriterIndex();
        ByteBufUtil.writeUtf8(buffer, anotherCharSequence, 0, anotherCharSequence.length());
        countBytes += buffer.writerIndex();
    }
    return countBytes;
}
Also used : AsciiString(io.netty.util.AsciiString) 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