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.
This commit is contained in:
Norman Maurer 2016-04-06 11:05:59 +02:00
parent b2651cc351
commit db74b2344f

View File

@ -225,7 +225,7 @@ abstract class PoolArena<T> implements PoolArenaMetric {
private synchronized void allocateNormal(PooledByteBuf<T> buf, int reqCapacity, int normCapacity) { private synchronized void allocateNormal(PooledByteBuf<T> buf, int reqCapacity, int normCapacity) {
if (q050.allocate(buf, reqCapacity, normCapacity) || q025.allocate(buf, reqCapacity, normCapacity) || if (q050.allocate(buf, reqCapacity, normCapacity) || q025.allocate(buf, reqCapacity, normCapacity) ||
q000.allocate(buf, reqCapacity, normCapacity) || qInit.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; ++allocationsNormal;
return; return;
} }