use of org.openjdk.jmh.annotations.BenchmarkMode in project logging-log4j2 by apache.
the class TimeFormatBenchmark method fastDateFormatReuseStringBuilder.
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public String fastDateFormatReuseStringBuilder(final BufferState state) {
state.stringBuilder.setLength(0);
fastDateFormat.format(new Date(), state.stringBuilder);
return new String(state.stringBuilder);
}
use of org.openjdk.jmh.annotations.BenchmarkMode in project logging-log4j2 by apache.
the class TextEncoderHelperBenchmark method serializableMCD.
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public long serializableMCD() {
final String str = PATTERN_M_C_D.toSerializable(EVENT);
final byte[] data = str.getBytes(CHARSET_DEFAULT);
ByteBuffer buff = destination.getByteBuffer();
if (buff.remaining() < data.length) {
buff = destination.drain(buff);
}
buff.put(data);
return destination.count;
}
Aggregations