Small performance improvement to avoid assignments if the list is empty.

This commit is contained in:
mlemanczyk committed 2023-06-28 22:56:41 +02:00
1 parent deb95a571c
commit 5fea2b44e4
1 file changed
+5
+5
View File
@@ -431,6 +431,11 @@ namespace Recyclable.Collections
[MethodImpl(MethodImplOptions.NoInlining)]
public void Clear()
{
if (_count == 0)
{
return;
}
if (NeedsClearing)
{
Array.Clear(_memoryBlock, 0, _count);