This repository was archived by the owner on Dec 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/test/java/io/netty/buffer/api/benchmarks Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ public class MemorySegmentClosedByCleanerBenchmark {
4444 private static final Allocator direct = Allocator .direct ();
4545 private static final Allocator withCleaner = Allocator .directWithCleaner ();
4646 private static final Allocator directPooled = Allocator .pooledDirect ();
47+ private static final Allocator pooledWithCleaner = Allocator .pooledDirectWithCleaner ();
4748
4849 @ Param ({"heavy" , "light" })
4950 public String workload ;
@@ -79,6 +80,18 @@ public Buf cleanerClose() throws Exception {
7980 return process (withCleaner .allocate (256 ));
8081 }
8182
83+ @ Benchmark
84+ public Buf cleanerClosePooled () throws Exception {
85+ return process (pooledWithCleaner .allocate (256 ));
86+ }
87+
88+ @ Benchmark
89+ public Buf pooledWithCleanerExplicitClose () throws Exception {
90+ try (Buf buf = pooledWithCleaner .allocate (256 )) {
91+ return process (buf );
92+ }
93+ }
94+
8295 private Buf process (Buf buffer ) throws Exception {
8396 // Simulate some async network server thingy, processing the buffer.
8497 var tlr = ThreadLocalRandom .current ();
You can’t perform that action at this time.
0 commit comments