Performance improvement - Removing unneeded check. There is no case the new block count == current block count.
This commit is contained in:
1 parent
35ccb12efc
commit
680776f259
1 file changed
-4
@@ -82,10 +82,6 @@ namespace Recyclable.Collections
|
|||||||
ArrayPool<T> blockArrayPool = _blockArrayPool;
|
ArrayPool<T> blockArrayPool = _blockArrayPool;
|
||||||
var sourceBlockCount = source?.Length ?? 0;
|
var sourceBlockCount = source?.Length ?? 0;
|
||||||
int requiredBlockCount = (int)(newCapacity / blockSize) + (newCapacity % blockSize > 0 ? 1 : 0);
|
int requiredBlockCount = (int)(newCapacity / blockSize) + (newCapacity % blockSize > 0 ? 1 : 0);
|
||||||
if (requiredBlockCount == sourceBlockCount)
|
|
||||||
{
|
|
||||||
return source!;
|
|
||||||
}
|
|
||||||
|
|
||||||
Span<T[]> newArraySpan;
|
Span<T[]> newArraySpan;
|
||||||
T[][] newMemoryBlocks = requiredBlockCount > RecyclableDefaults.MinPooledArrayLength
|
T[][] newMemoryBlocks = requiredBlockCount > RecyclableDefaults.MinPooledArrayLength
|
||||||
|
|||||||
Reference in new issue
Block a user