diff --git a/Recyclable.Collections/RecyclableList.cs b/Recyclable.Collections/RecyclableList.cs index 345246b..68b091f 100644 --- a/Recyclable.Collections/RecyclableList.cs +++ b/Recyclable.Collections/RecyclableList.cs @@ -6,7 +6,6 @@ namespace Recyclable.Collections [Serializable] public sealed partial class RecyclableList : IList, IReadOnlyList, IDisposable { - // private static readonly T[] _emptyMemoryBlock = new T[0]; private static readonly bool NeedsClearing = !typeof(T).IsValueType; public static explicit operator ReadOnlySpan(RecyclableList source) => new(source._memoryBlock, 0, source.Count); @@ -173,7 +172,6 @@ namespace Recyclable.Collections if (_capacity != value) { RecyclableListHelpers.ResizeAndCopy(this, value); - // _capacity = _memoryBlock.Length; _version++; } } @@ -189,16 +187,6 @@ namespace Recyclable.Collections { // TODO: Measure performance // ArrayPool arrayPool = _arrayPool; - // & WAS SLOWER - // int newSize = _capacity << 1; - // & WAS SLOWER - // if ((_capacity <<= 1) < RecyclableDefaults.MinPooledArrayLength) - // { - // Array.Resize(ref _memoryBlock, _capacity); - // // _capacity <<= 1; - // return; - // } - // TODO: Measure performance after RecyclableArrayPool is reworked // T[] newMemoryBlock = RecyclableListHelpers._arrayPool.Rent(_capacity <<= 1); T[] newMemoryBlock = (_capacity <<= 1) >= RecyclableDefaults.MinPooledArrayLength @@ -208,8 +196,6 @@ namespace Recyclable.Collections // & WAS SLOWER WITHOUT T[] oldMemoryBlock = _memoryBlock; new Span(oldMemoryBlock).CopyTo(newMemoryBlock); - // & WAS SLOWER - // Array.Copy(oldMemoryBlock, newMemoryBlock, oldMemoryBlock.Length); if (oldMemoryBlock.Length >= RecyclableDefaults.MinPooledArrayLength) { @@ -233,27 +219,8 @@ namespace Recyclable.Collections if (_count == _capacity) { ResizeAndCopy(); - // & WAS SLOWER - // new Span(_memoryBlock)[_count++] = item; - // } - // else - // if (_capacity == _count) - // { - // break; - - // case false: - // newCapacity = requestedCapacity; - // list._memoryBlock = Resize(list, newCapacity); - // break; - // } - - // var newCapacity = list._memoryBlock.Length; - // _capacity = _memoryBlock.Length; } - // & WAS SLOWER - // new Span(_memoryBlock)[_count++] = item; - // new Span(_memoryBlock, _count++, 1)[0] = item; _memoryBlock[_count++] = item; _version++; }