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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations