From 680776f2594617ac4583d7c80f2f2e1c7a86c365 Mon Sep 17 00:00:00 2001 From: mlemanczyk Date: Sat, 28 Jan 2023 14:18:34 +0100 Subject: [PATCH] Performance improvement - Removing unneeded check. There is no case the new block count == current block count. --- Recyclable.Collections/RecyclableList.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Recyclable.Collections/RecyclableList.cs b/Recyclable.Collections/RecyclableList.cs index 8507cbe..04f1125 100644 --- a/Recyclable.Collections/RecyclableList.cs +++ b/Recyclable.Collections/RecyclableList.cs @@ -82,10 +82,6 @@ namespace Recyclable.Collections ArrayPool blockArrayPool = _blockArrayPool; var sourceBlockCount = source?.Length ?? 0; int requiredBlockCount = (int)(newCapacity / blockSize) + (newCapacity % blockSize > 0 ? 1 : 0); - if (requiredBlockCount == sourceBlockCount) - { - return source!; - } Span newArraySpan; T[][] newMemoryBlocks = requiredBlockCount > RecyclableDefaults.MinPooledArrayLength