From 2d55e537d07a6a9967c851626be7d205a9f75b3e Mon Sep 17 00:00:00 2001 From: mlemanczyk Date: Sun, 30 Apr 2023 22:13:21 +0200 Subject: [PATCH] Tiny cleanup --- Recyclable.Collections/RecyclableList.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Recyclable.Collections/RecyclableList.cs b/Recyclable.Collections/RecyclableList.cs index 0a00087..9f2527d 100644 --- a/Recyclable.Collections/RecyclableList.cs +++ b/Recyclable.Collections/RecyclableList.cs @@ -980,10 +980,11 @@ namespace Recyclable.Collections [MethodImpl(MethodImplOptions.AggressiveInlining)] public int IndexOf(T item) => _longCount == 0 - ? ItemNotFoundIndex - : _longCount <= _blockSize - ? Array.IndexOf(_memoryBlocks[0], item, 0, checked((int)_longCount)) - : checked((int)DoIndexOfParallel(item)); + ? ItemNotFoundIndex + //// Optimization for tiny collections to avoid any vars etc. + : _longCount <= _blockSize + ? Array.IndexOf(_memoryBlocks[0], item, 0, checked((int)_longCount)) + : checked((int)DoIndexOfParallel(item)); public void Insert(int index, T item) => throw new NotSupportedException();