Performance improvement for low no. of items
This commit is contained in:
1 parent
be9dfaf43a
commit
9676ee7485
1 file changed
+5
@@ -516,6 +516,11 @@ namespace Recyclable.Collections
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_lastBlockIndex == 0 || (_lastBlockIndex == 1 && _nextItemIndex == 0))
|
||||
{
|
||||
return Array.IndexOf(_memoryBlocks[0], item, 0, (int)_longCount) >= 0;
|
||||
}
|
||||
|
||||
Span<T[]> memoryBlocksSpan = new(_memoryBlocks);
|
||||
int lastBlockIndex = _lastBlockIndex;
|
||||
for (int blockIndex = 0; blockIndex < lastBlockIndex; blockIndex++)
|
||||
|
||||
Reference in new issue
Block a user