From 413d625d8e32243161d4a1d629fca919f5c2df0c Mon Sep 17 00:00:00 2001 From: mlemanczyk Date: Sun, 25 Jun 2023 20:56:49 +0200 Subject: [PATCH] Tiny cleanup. Commented out code removed. --- Recyclable.Collections/RecyclableList.cs | 24 ------------ Recyclable.Collections/RecyclableLongList.cs | 39 -------------------- 2 files changed, 63 deletions(-) diff --git a/Recyclable.Collections/RecyclableList.cs b/Recyclable.Collections/RecyclableList.cs index 1807a6c..3bc76d2 100644 --- a/Recyclable.Collections/RecyclableList.cs +++ b/Recyclable.Collections/RecyclableList.cs @@ -16,9 +16,6 @@ namespace Recyclable.Collections #nullable disable private T[] _memoryBlock; #nullable restore - // & WAS SLOWER - // internal RecyclableCollectionVersion _version; - // public RecyclableCollectionVersion Version => _version; private ulong _version; public ulong Version => _version; @@ -85,11 +82,6 @@ namespace Recyclable.Collections if (source?.Length > 0) { Array.Copy(source!, 0, newMemoryBlock, 0, source!.Length); - //var sourceSpan = new Memory(source); - //var newArraySpan = new Memory(newMemoryBlock); - - //sourceSpan.CopyTo(newArraySpan); - if (source!.Length >= RecyclableDefaults.MinPooledArrayLength) { arrayPool.Return(source!, NeedsClearing); @@ -221,22 +213,6 @@ namespace Recyclable.Collections private int _count; public int Count => _count; - //{ - // [MethodImpl(MethodImplOptions.AggressiveInlining)] - // get => _count; - - // [MethodImpl(MethodImplOptions.AggressiveInlining)] - // // TODO: Clear items if we're decreasing the size of the list, if T is reference type - // set - // { - // _count = value; - - // if (_version?.IsVersioned ?? false) - // { - // _version.Inc(); - // } - // } - //} public bool IsReadOnly => false; diff --git a/Recyclable.Collections/RecyclableLongList.cs b/Recyclable.Collections/RecyclableLongList.cs index 6588a2e..897c4f9 100644 --- a/Recyclable.Collections/RecyclableLongList.cs +++ b/Recyclable.Collections/RecyclableLongList.cs @@ -346,41 +346,6 @@ namespace Recyclable.Collections return minBlockSize; } - // & WAS SLOWER - // [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] - // & WAS SLOWER - // [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] - // & WAS SLOWER - // [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.NoOptimization)] - // & WAS SLOWER - // [MethodImpl(MethodImplOptions.NoInlining)] - //private static void Iterate(RecyclableLongList list, in ParallelSynchronizationContext context, in T itemToFind) - //{ - // // TODO: Switch to use _blockSize instead of list._longCountIndeexOfStep for simplifications & better performance. - - // // & WAS SLOWER without - // int blockIndex = 0; - - // long itemsCount = list._longCount; - // // & WAS SLOWER - // // int blockSize = _blockSize; - // // & WAS SLOWER - // // while ((blockIndex << list._blockSizePow2BitShift) + itemIndex > step) - // while (itemsCount > list._blockSize) - // { - // // At this point itemIndex is limited to blockSize range - int. - // if (!ScheduleIndexOfTask(context, list, blockIndex, list._blockSize, itemToFind)) - // { - // break; - // } - - // itemsCount -= list._blockSize; - // blockIndex++; - // } - - // _ = ScheduleIndexOfTask(context, list, blockIndex, (int)itemsCount, itemToFind); - //} - [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] protected static void SetupBlockArrayPooling(RecyclableLongList list, int blockSize, ArrayPool? blockArrayPool = null) { @@ -1134,8 +1099,6 @@ namespace Recyclable.Collections } else { - // & WAS SLOWER - // long toSearch = _longCount - _blockSize; if (_longCount > _blockSize) { itemIndex = Array.IndexOf(_memoryBlocks[1], item, 0, (int)Math.Min(_blockSize, _longCount - _blockSize)); @@ -1173,8 +1136,6 @@ namespace Recyclable.Collections } else { - // & WAS SLOWER - // long toSearch = _longCount - _blockSize; if (_longCount > _blockSize) { itemIndex = Array.IndexOf(_memoryBlocks[1], item, 0, (int)Math.Min(_blockSize, _longCount - _blockSize));