diff --git a/src/test/java/io/netty/buffer/api/benchmarks/MemorySegmentClosedByCleanerBenchmark.java b/src/test/java/io/netty/buffer/api/benchmarks/MemorySegmentClosedByCleanerBenchmark.java index ad2e73b..42f17e5 100644 --- a/src/test/java/io/netty/buffer/api/benchmarks/MemorySegmentClosedByCleanerBenchmark.java +++ b/src/test/java/io/netty/buffer/api/benchmarks/MemorySegmentClosedByCleanerBenchmark.java @@ -44,6 +44,7 @@ public class MemorySegmentClosedByCleanerBenchmark { private static final Allocator direct = Allocator.direct(); private static final Allocator withCleaner = Allocator.directWithCleaner(); private static final Allocator directPooled = Allocator.pooledDirect(); + private static final Allocator pooledWithCleaner = Allocator.pooledDirectWithCleaner(); @Param({"heavy", "light"}) public String workload; @@ -79,6 +80,18 @@ public class MemorySegmentClosedByCleanerBenchmark { return process(withCleaner.allocate(256)); } + @Benchmark + public Buf cleanerClosePooled() throws Exception { + return process(pooledWithCleaner.allocate(256)); + } + + @Benchmark + public Buf pooledWithCleanerExplicitClose() throws Exception { + try (Buf buf = pooledWithCleaner.allocate(256)) { + return process(buf); + } + } + private Buf process(Buf buffer) throws Exception { // Simulate some async network server thingy, processing the buffer. var tlr = ThreadLocalRandom.current();