Small performance improvements to avoid repeated clearing of the buffers.
This commit is contained in:
1 parent
6b3b30fc12
commit
4f7af026f7
2 files changed
+4
-2
No files matched your search
@@ -535,7 +535,8 @@ namespace Recyclable.Collections
|
||||
Clear();
|
||||
if (_count is >= RecyclableDefaults.MinPooledArrayLength)
|
||||
{
|
||||
_arrayPool.Return(_memoryBlock, NeedsClearing);
|
||||
// If anything, it has been already cleared by .Clear(), Remove() or RemoveAt() methods, as the list was modified / disposed.
|
||||
_arrayPool.Return(_memoryBlock, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1302,7 +1302,8 @@ namespace Recyclable.Collections
|
||||
Clear();
|
||||
if (_memoryBlocks.Length >= RecyclableDefaults.MinPooledArrayLength)
|
||||
{
|
||||
_memoryBlocksPool.Return(_memoryBlocks, NeedsClearing);
|
||||
// If anything, it has been already cleared by .Clear(), Remove() or RemoveAt() methods, as the list was modified / disposed.
|
||||
_memoryBlocksPool.Return(_memoryBlocks, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user