Small performance improvement to avoid assignments if the list is empty.
This commit is contained in:
1 parent
deb95a571c
commit
5fea2b44e4
1 file changed
+5
@@ -431,6 +431,11 @@ namespace Recyclable.Collections
|
|||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
|
if (_count == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (NeedsClearing)
|
if (NeedsClearing)
|
||||||
{
|
{
|
||||||
Array.Clear(_memoryBlock, 0, _count);
|
Array.Clear(_memoryBlock, 0, _count);
|
||||||
|
|||||||
Reference in new issue
Block a user