Performance improvement - Removing unneeded check. There is no case the new block count == current block count.

This commit is contained in:
mlemanczyk committed 2023-01-28 14:18:34 +01:00
1 parent 35ccb12efc
commit 680776f259
1 file changed
-4
-4
View File
@@ -82,10 +82,6 @@ namespace Recyclable.Collections
ArrayPool<T> blockArrayPool = _blockArrayPool;
var sourceBlockCount = source?.Length ?? 0;
int requiredBlockCount = (int)(newCapacity / blockSize) + (newCapacity % blockSize > 0 ? 1 : 0);
if (requiredBlockCount == sourceBlockCount)
{
return source!;
}
Span<T[]> newArraySpan;
T[][] newMemoryBlocks = requiredBlockCount > RecyclableDefaults.MinPooledArrayLength