From 635fc9eae03f87e7854d49cf8f8d030215513ddb Mon Sep 17 00:00:00 2001 From: Francesco Nigro Date: Mon, 15 Apr 2019 15:14:36 +0200 Subject: [PATCH] The benchmark is not taking into account nanoTime granularity (#9033) Motivation: Results are just wrong for small delays. Modifications: Switching to AvarageTime avoid to rely on OS nanoTime granularity. Result: Uncontended low delay results are not reliable --- .../buffer/AbstractReferenceCountedByteBufBenchmark.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/microbench/src/main/java/io/netty/buffer/AbstractReferenceCountedByteBufBenchmark.java b/microbench/src/main/java/io/netty/buffer/AbstractReferenceCountedByteBufBenchmark.java index 985eb7056a..a9a2677c16 100644 --- a/microbench/src/main/java/io/netty/buffer/AbstractReferenceCountedByteBufBenchmark.java +++ b/microbench/src/main/java/io/netty/buffer/AbstractReferenceCountedByteBufBenchmark.java @@ -49,7 +49,7 @@ public class AbstractReferenceCountedByteBufBenchmark extends AbstractMicrobench } @Benchmark - @BenchmarkMode(Mode.SampleTime) + @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) public boolean retainReleaseUncontended() { buf.retain(); @@ -58,9 +58,9 @@ public class AbstractReferenceCountedByteBufBenchmark extends AbstractMicrobench } @Benchmark - @BenchmarkMode(Mode.SampleTime) + @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) - @GroupThreads(6) + @GroupThreads(4) public boolean retainReleaseContended() { buf.retain(); Blackhole.consumeCPU(delay);