From 326999c682207159cb8952850025d74bd3b60a87 Mon Sep 17 00:00:00 2001 From: mlemanczyk Date: Sun, 29 Jan 2023 14:48:30 +0100 Subject: [PATCH] Performance improvement - reuse local var --- Recyclable.Collections/RecyclableList.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Recyclable.Collections/RecyclableList.cs b/Recyclable.Collections/RecyclableList.cs index 9439072..ad5101c 100644 --- a/Recyclable.Collections/RecyclableList.cs +++ b/Recyclable.Collections/RecyclableList.cs @@ -45,6 +45,7 @@ namespace Recyclable.Collections } list._longCount--; + int blockSize = list._blockSize; if (list._lastItemIndex > 0) { list._lastItemIndex--; @@ -52,10 +53,9 @@ namespace Recyclable.Collections else { list._lastBlockIndex--; - list._lastItemIndex = list._blockSize; + list._lastItemIndex = blockSize; } - int blockSize = list._blockSize; if ((list._capacity * blockSize) - oldCountMinus1 == blockSize) { T[][] memoryBlocks = list._memoryBlocks;