From db74b2344f70628c88b89e566597e5a2cbdccde4 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 6 Apr 2016 11:05:59 +0200 Subject: [PATCH] Not try to allocate out of the PoolChunkList that contains only full PoolChunks Motivation: When doing a normal allocation in PoolArena we also tried to allocate out of the PoolChunkList that only contains completely full PoolChunks. This makes no sense as these are full anyway so an allocation will never work here and just gives a perf hit as we need to walk the whole list of PoolChunks in the list. Modifications: Not try to allocate from PoolChunkList that only contains full PoolChunks Result: Faster allocation times when a new PoolChunk must be created. --- buffer/src/main/java/io/netty/buffer/PoolArena.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buffer/src/main/java/io/netty/buffer/PoolArena.java b/buffer/src/main/java/io/netty/buffer/PoolArena.java index 6899a6a912..086ccc0042 100644 --- a/buffer/src/main/java/io/netty/buffer/PoolArena.java +++ b/buffer/src/main/java/io/netty/buffer/PoolArena.java @@ -225,7 +225,7 @@ abstract class PoolArena implements PoolArenaMetric { private synchronized void allocateNormal(PooledByteBuf buf, int reqCapacity, int normCapacity) { if (q050.allocate(buf, reqCapacity, normCapacity) || q025.allocate(buf, reqCapacity, normCapacity) || q000.allocate(buf, reqCapacity, normCapacity) || qInit.allocate(buf, reqCapacity, normCapacity) || - q075.allocate(buf, reqCapacity, normCapacity) || q100.allocate(buf, reqCapacity, normCapacity)) { + q075.allocate(buf, reqCapacity, normCapacity)) { ++allocationsNormal; return; }