Performance improvement - reuse local var

This commit is contained in:
mlemanczyk committed 2023-01-29 14:48:30 +01:00
1 parent a3335bf4e7
commit 326999c682
1 file changed
+2 -2
+2 -2
View File
@@ -45,6 +45,7 @@ namespace Recyclable.Collections
} }
list._longCount--; list._longCount--;
int blockSize = list._blockSize;
if (list._lastItemIndex > 0) if (list._lastItemIndex > 0)
{ {
list._lastItemIndex--; list._lastItemIndex--;
@@ -52,10 +53,9 @@ namespace Recyclable.Collections
else else
{ {
list._lastBlockIndex--; list._lastBlockIndex--;
list._lastItemIndex = list._blockSize; list._lastItemIndex = blockSize;
} }
int blockSize = list._blockSize;
if ((list._capacity * blockSize) - oldCountMinus1 == blockSize) if ((list._capacity * blockSize) - oldCountMinus1 == blockSize)
{ {
T[][] memoryBlocks = list._memoryBlocks; T[][] memoryBlocks = list._memoryBlocks;