Merge pull request #9 from netty/more-close-benchmarks
Add benchmark for closing pooled buffers
This commit is contained in:
commit
e039f6f7f5
@ -43,6 +43,7 @@ import static java.util.concurrent.CompletableFuture.completedFuture;
|
|||||||
public class MemorySegmentClosedByCleanerBenchmark {
|
public class MemorySegmentClosedByCleanerBenchmark {
|
||||||
private static final Allocator direct = Allocator.direct();
|
private static final Allocator direct = Allocator.direct();
|
||||||
private static final Allocator withCleaner = Allocator.directWithCleaner();
|
private static final Allocator withCleaner = Allocator.directWithCleaner();
|
||||||
|
private static final Allocator directPooled = Allocator.pooledDirect();
|
||||||
|
|
||||||
@Param({"heavy", "light"})
|
@Param({"heavy", "light"})
|
||||||
public String workload;
|
public String workload;
|
||||||
@ -66,6 +67,13 @@ public class MemorySegmentClosedByCleanerBenchmark {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
public Buf explicitPooledClose() throws Exception {
|
||||||
|
try (Buf buf = process(directPooled.allocate(256))) {
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
public Buf cleanerClose() throws Exception {
|
public Buf cleanerClose() throws Exception {
|
||||||
return process(withCleaner.allocate(256));
|
return process(withCleaner.allocate(256));
|
||||||
|
Loading…
Reference in New Issue
Block a user