RecyclableArrayList renamed to RecyclableList
This commit is contained in:
1 parent
cf0c86d353
commit
1a723c6f4f
37 files changed
+171
-171
No files matched your search
@@ -26,11 +26,11 @@ namespace Recyclable.Collections.Benchmarks
|
||||
}
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_Add()
|
||||
public void RecyclableList_Add()
|
||||
{
|
||||
var data = TestObjects;
|
||||
var dataCount = TestObjectCount;
|
||||
using var list = new RecyclableArrayList<long>();
|
||||
using var list = new RecyclableList<long>();
|
||||
for (var i = 0; i < dataCount; i++)
|
||||
{
|
||||
list.Add(data[i]);
|
||||
|
||||
@@ -18,10 +18,10 @@ namespace Recyclable.Collections.Benchmarks
|
||||
list.AddRange(data);
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_AddRangeWhenSourceIsArray()
|
||||
public void RecyclableList_AddRangeWhenSourceIsArray()
|
||||
{
|
||||
var data = TestObjects;
|
||||
using var list = new RecyclableArrayList<long>();
|
||||
using var list = new RecyclableList<long>();
|
||||
list.AddRange(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ namespace Recyclable.Collections.Benchmarks
|
||||
list.AddRange(data);
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_AddRangeWhenSourceIsIEnumerable()
|
||||
public void RecyclableList_AddRangeWhenSourceIsIEnumerable()
|
||||
{
|
||||
var data = TestObjectsAsIEnumerable;
|
||||
using var list = new RecyclableArrayList<long>();
|
||||
using var list = new RecyclableList<long>();
|
||||
list.AddRange(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ namespace Recyclable.Collections.Benchmarks
|
||||
list.AddRange(data);
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_AddRangeWhenSourceIsIList()
|
||||
public void RecyclableList_AddRangeWhenSourceIsIList()
|
||||
{
|
||||
var data = (IList<long>)TestObjectsAsRecyclableLongList;
|
||||
using var list = new RecyclableArrayList<long>();
|
||||
using var list = new RecyclableList<long>();
|
||||
list.AddRange(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ namespace Recyclable.Collections.Benchmarks
|
||||
list.AddRange(data);
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_AddRangeWhenSourceIsList()
|
||||
public void RecyclableList_AddRangeWhenSourceIsList()
|
||||
{
|
||||
var data = TestObjectsAsList;
|
||||
using var list = new RecyclableArrayList<long>();
|
||||
using var list = new RecyclableList<long>();
|
||||
list.AddRange(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,16 +11,16 @@ namespace Recyclable.Collections.Benchmarks
|
||||
list.AddRange(data);
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_AddRangeWhenSourceIsRecyclableArrayList()
|
||||
public void RecyclableList_AddRangeWhenSourceIsRecyclableList()
|
||||
{
|
||||
var data = TestObjectsAsRecyclableArrayList;
|
||||
using var list = new RecyclableArrayList<long>();
|
||||
var data = TestObjectsAsRecyclableList;
|
||||
using var list = new RecyclableList<long>();
|
||||
list.AddRange(data);
|
||||
}
|
||||
|
||||
public void RecyclableLongList_AddRangeWhenSourceIsRecyclableArrayList()
|
||||
public void RecyclableLongList_AddRangeWhenSourceIsRecyclableList()
|
||||
{
|
||||
var data = TestObjectsAsRecyclableArrayList;
|
||||
var data = TestObjectsAsRecyclableList;
|
||||
using var list = new RecyclableLongList<long>(minBlockSize: BlockSize, expectedItemsCount: TestObjectCount);
|
||||
list.AddRange(data);
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@ namespace Recyclable.Collections.Benchmarks
|
||||
list.AddRange(data);
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_AddRange_WithCapacity()
|
||||
public void RecyclableList_AddRange_WithCapacity()
|
||||
{
|
||||
var data = TestObjects;
|
||||
var dataCount = TestObjectCount;
|
||||
using var list = new RecyclableArrayList<long>(dataCount);
|
||||
using var list = new RecyclableList<long>(dataCount);
|
||||
list.AddRange(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace Recyclable.Collections.Benchmarks
|
||||
}
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_Add_WithCapacity()
|
||||
public void RecyclableList_Add_WithCapacity()
|
||||
{
|
||||
var data = TestObjects;
|
||||
var dataCount = TestObjectCount;
|
||||
using var list = new RecyclableArrayList<long>(dataCount);
|
||||
using var list = new RecyclableList<long>(dataCount);
|
||||
for (var i = 0; i < dataCount; i++)
|
||||
{
|
||||
list.Add(data[i]);
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_Contains_FirstItems()
|
||||
public void RecyclableList_Contains_FirstItems()
|
||||
{
|
||||
var data = TestObjects;
|
||||
var list = TestObjectsAsRecyclableArrayList;
|
||||
var list = TestObjectsAsRecyclableList;
|
||||
var dataCount = TestObjectCount / 10 > 0 ? TestObjectCount / 10 : TestObjectCount;
|
||||
for (var i = 0; i < dataCount; i++)
|
||||
{
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_Contains_LastItems()
|
||||
public void RecyclableList_Contains_LastItems()
|
||||
{
|
||||
var data = TestObjects;
|
||||
var list = TestObjectsAsRecyclableArrayList;
|
||||
var list = TestObjectsAsRecyclableList;
|
||||
var dataCount = TestObjectCount / 10 > 0 ? TestObjectCount / 10 : TestObjectCount;
|
||||
for (var i = 0; i < dataCount; i++)
|
||||
{
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
DoNothing(data.Count);
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_Count()
|
||||
public void RecyclableList_Count()
|
||||
{
|
||||
var data = TestObjectsAsRecyclableArrayList;
|
||||
var data = TestObjectsAsRecyclableList;
|
||||
DoNothing(data.Count);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ namespace Recyclable.Collections.Benchmarks
|
||||
DoNothing(list);
|
||||
}
|
||||
|
||||
public static void RecyclableArrayList_Create()
|
||||
public static void RecyclableList_Create()
|
||||
{
|
||||
using var list = new RecyclableArrayList<long>();
|
||||
using var list = new RecyclableList<long>();
|
||||
DoNothing(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ namespace Recyclable.Collections.Benchmarks
|
||||
DoNothing(list);
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_Create_WithCapacity()
|
||||
public void RecyclableList_Create_WithCapacity()
|
||||
{
|
||||
using var list = new RecyclableArrayList<long>(TestObjectCount);
|
||||
using var list = new RecyclableList<long>(TestObjectCount);
|
||||
DoNothing(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_GetItem()
|
||||
public void RecyclableList_GetItem()
|
||||
{
|
||||
var data = TestObjectsAsRecyclableArrayList;
|
||||
var data = TestObjectsAsRecyclableList;
|
||||
var dataCount = TestObjectCount;
|
||||
for (var i = 0; i < dataCount; i++)
|
||||
{
|
||||
|
||||
@@ -38,10 +38,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_IndexOf_BestAndWorstCases()
|
||||
public void RecyclableList_IndexOf_BestAndWorstCases()
|
||||
{
|
||||
var data = TestObjects;
|
||||
var list = TestObjectsAsRecyclableArrayList;
|
||||
var list = TestObjectsAsRecyclableList;
|
||||
var dataCount = TestObjectCountForSlowMethods;
|
||||
for (var i = 0; i < dataCount; i++)
|
||||
{
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_IndexOf_FirstItems()
|
||||
public void RecyclableList_IndexOf_FirstItems()
|
||||
{
|
||||
var data = TestObjects;
|
||||
var list = TestObjectsAsRecyclableArrayList;
|
||||
var list = TestObjectsAsRecyclableList;
|
||||
var dataCount = TestObjectCountForSlowMethods;
|
||||
for (var i = 0; i < dataCount; i++)
|
||||
{
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_IndexOf_LastItems()
|
||||
public void RecyclableList_IndexOf_LastItems()
|
||||
{
|
||||
var data = TestObjects;
|
||||
var list = TestObjectsAsRecyclableArrayList;
|
||||
var list = TestObjectsAsRecyclableList;
|
||||
var dataCount = TestObjectCountForSlowMethods;
|
||||
for (var i = 0; i < dataCount; i++)
|
||||
{
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Recyclable.Collections.Benchmarks
|
||||
RecyclableCollectionsBenchmarkSource.Array,
|
||||
RecyclableCollectionsBenchmarkSource.List,
|
||||
RecyclableCollectionsBenchmarkSource.PooledList,
|
||||
RecyclableCollectionsBenchmarkSource.RecyclableArrayList,
|
||||
RecyclableCollectionsBenchmarkSource.RecyclableList,
|
||||
RecyclableCollectionsBenchmarkSource.RecyclableLongList
|
||||
)]
|
||||
public override RecyclableCollectionsBenchmarkSource BenchmarkType { get => base.BenchmarkType; set => base.BenchmarkType = value; }
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace Recyclable.Collections.Benchmarks
|
||||
}
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_RemoveAt_FirstItems()
|
||||
public void RecyclableList_RemoveAt_FirstItems()
|
||||
{
|
||||
var data = TestObjects;
|
||||
using var list = new RecyclableArrayList<long>(data);
|
||||
using var list = new RecyclableList<long>(data);
|
||||
var dataCount = TestObjectCount / 10 > 0 ? TestObjectCount / 10 : TestObjectCount;
|
||||
for (var i = 0; i < dataCount; i++)
|
||||
{
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace Recyclable.Collections.Benchmarks
|
||||
}
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_RemoveAt_LastItems()
|
||||
public void RecyclableList_RemoveAt_LastItems()
|
||||
{
|
||||
var data = TestObjects;
|
||||
using var list = new RecyclableArrayList<long>(data);
|
||||
using var list = new RecyclableList<long>(data);
|
||||
var dataCount = TestObjectCount / 10 > 0 ? TestObjectCount / 10 : TestObjectCount;
|
||||
for (var i = data.Length - 1; i > data.Length - dataCount - 1; i--)
|
||||
{
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace Recyclable.Collections.Benchmarks
|
||||
}
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_Remove_FirstItems()
|
||||
public void RecyclableList_Remove_FirstItems()
|
||||
{
|
||||
var data = TestObjects;
|
||||
using var list = new RecyclableArrayList<long>(data);
|
||||
using var list = new RecyclableList<long>(data);
|
||||
var dataCount = TestObjectCount / 10 > 0 ? TestObjectCount / 10 : TestObjectCount;
|
||||
for (var i = 0; i < dataCount; i++)
|
||||
{
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace Recyclable.Collections.Benchmarks
|
||||
}
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_Remove_LastItems()
|
||||
public void RecyclableList_Remove_LastItems()
|
||||
{
|
||||
var data = TestObjects;
|
||||
using var list = new RecyclableArrayList<long>(data);
|
||||
using var list = new RecyclableList<long>(data);
|
||||
var dataCount = TestObjectCount / 10 > 0 ? TestObjectCount / 10 : TestObjectCount;
|
||||
for (var i = data.Length - 1; i > data.Length - dataCount - 1; i--)
|
||||
{
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
public void RecyclableArrayList_SetItem()
|
||||
public void RecyclableList_SetItem()
|
||||
{
|
||||
var data = TestObjectsAsRecyclableArrayList;
|
||||
var data = TestObjectsAsRecyclableList;
|
||||
var dataCount = TestObjectCount;
|
||||
for (var i = 0; i < dataCount; i++)
|
||||
{
|
||||
|
||||
+9
-9
@@ -481,7 +481,7 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
_nextItemBlockIndex = targetBlockIndex;
|
||||
}
|
||||
|
||||
public void AddRange(RecyclableArrayList<T> items)
|
||||
public void AddRange(RecyclableList<T> items)
|
||||
{
|
||||
if (items.Count == 0)
|
||||
{
|
||||
@@ -697,9 +697,9 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
return;
|
||||
}
|
||||
|
||||
if (source is RecyclableArrayList<T> sourceRecyclableArrayList)
|
||||
if (source is RecyclableList<T> sourceRecyclableList)
|
||||
{
|
||||
AddRange(sourceRecyclableArrayList);
|
||||
AddRange(sourceRecyclableList);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1379,7 +1379,7 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
_nextItemBlockIndex = targetBlockIndex;
|
||||
}
|
||||
|
||||
public void AddRange(RecyclableArrayList<T> items)
|
||||
public void AddRange(RecyclableList<T> items)
|
||||
{
|
||||
if (items.Count == 0)
|
||||
{
|
||||
@@ -1597,9 +1597,9 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
return;
|
||||
}
|
||||
|
||||
if (source is RecyclableArrayList<T> sourceRecyclableArrayList)
|
||||
if (source is RecyclableList<T> sourceRecyclableList)
|
||||
{
|
||||
AddRange(sourceRecyclableArrayList);
|
||||
AddRange(sourceRecyclableList);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2340,7 +2340,7 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
_nextItemBlockIndex = targetBlockIndex;
|
||||
}
|
||||
|
||||
public void AddRange(RecyclableArrayList<T> items)
|
||||
public void AddRange(RecyclableList<T> items)
|
||||
{
|
||||
if (items.Count == 0)
|
||||
{
|
||||
@@ -2558,9 +2558,9 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
return;
|
||||
}
|
||||
|
||||
if (source is RecyclableArrayList<T> sourceRecyclableArrayList)
|
||||
if (source is RecyclableList<T> sourceRecyclableList)
|
||||
{
|
||||
AddRange(sourceRecyclableArrayList);
|
||||
AddRange(sourceRecyclableList);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -759,7 +759,7 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
_nextItemBlockIndex = targetBlockIndex;
|
||||
}
|
||||
|
||||
public void AddRange(RecyclableArrayList<T> items)
|
||||
public void AddRange(RecyclableList<T> items)
|
||||
{
|
||||
if (items.Count == 0)
|
||||
{
|
||||
@@ -981,9 +981,9 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
return;
|
||||
}
|
||||
|
||||
if (source is RecyclableArrayList<T> sourceRecyclableArrayList)
|
||||
if (source is RecyclableList<T> sourceRecyclableList)
|
||||
{
|
||||
AddRange(sourceRecyclableArrayList);
|
||||
AddRange(sourceRecyclableList);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1904,7 +1904,7 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
_nextItemBlockIndex = targetBlockIndex;
|
||||
}
|
||||
|
||||
public void AddRange(RecyclableArrayList<T> items)
|
||||
public void AddRange(RecyclableList<T> items)
|
||||
{
|
||||
if (items.Count == 0)
|
||||
{
|
||||
@@ -2126,9 +2126,9 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
return;
|
||||
}
|
||||
|
||||
if (source is RecyclableArrayList<T> sourceRecyclableArrayList)
|
||||
if (source is RecyclableList<T> sourceRecyclableList)
|
||||
{
|
||||
AddRange(sourceRecyclableArrayList);
|
||||
AddRange(sourceRecyclableList);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3021,7 +3021,7 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
_nextItemBlockIndex = targetBlockIndex;
|
||||
}
|
||||
|
||||
public void AddRange(RecyclableArrayList<T> items)
|
||||
public void AddRange(RecyclableList<T> items)
|
||||
{
|
||||
if (items.Count == 0)
|
||||
{
|
||||
@@ -3243,9 +3243,9 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
return;
|
||||
}
|
||||
|
||||
if (source is RecyclableArrayList<T> sourceRecyclableArrayList)
|
||||
if (source is RecyclableList<T> sourceRecyclableList)
|
||||
{
|
||||
AddRange(sourceRecyclableArrayList);
|
||||
AddRange(sourceRecyclableList);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4175,7 +4175,7 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
_nextItemBlockIndex = targetBlockIndex;
|
||||
}
|
||||
|
||||
public void AddRange(RecyclableArrayList<T> items)
|
||||
public void AddRange(RecyclableList<T> items)
|
||||
{
|
||||
if (items.Count == 0)
|
||||
{
|
||||
@@ -4397,9 +4397,9 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
return;
|
||||
}
|
||||
|
||||
if (source is RecyclableArrayList<T> sourceRecyclableArrayList)
|
||||
if (source is RecyclableList<T> sourceRecyclableList)
|
||||
{
|
||||
AddRange(sourceRecyclableArrayList);
|
||||
AddRange(sourceRecyclableList);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
[Params(RecyclableLongListPocBenchmarkType.IndexOf)]
|
||||
public override RecyclableLongListPocBenchmarkType BenchmarkType { get => base.BenchmarkType; set => base.BenchmarkType = value; }
|
||||
|
||||
// [Params(BenchmarkType.Array, BenchmarkType.List, BenchmarkType.RecyclableArrayList, BenchmarkType.RecyclableLongList)]
|
||||
// [Params(BenchmarkType.Array, BenchmarkType.List, BenchmarkType.RecyclableList, BenchmarkType.RecyclableLongList)]
|
||||
[Params(RecyclableLongListPocBenchmarkType.IndexOf_PooledList)]
|
||||
public override RecyclableLongListPocBenchmarkType BaselineBenchmarkType { get => base.BaselineBenchmarkType; set => base.BaselineBenchmarkType = value; }
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Recyclable.Collections.Benchmarks
|
||||
Array,
|
||||
List,
|
||||
PooledList,
|
||||
RecyclableArrayList,
|
||||
RecyclableList,
|
||||
RecyclableLongList,
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ namespace Recyclable.Collections.Benchmarks
|
||||
|
||||
protected PooledList<long>? _testObjectsAsPooledList;
|
||||
public PooledList<long> TestObjectsAsPooledList => _testObjectsAsPooledList ?? throw new NullReferenceException("Something is wrong and the field is not initialized");
|
||||
protected RecyclableArrayList<long>? _testObjectsAsRecyclableArrayList;
|
||||
protected RecyclableArrayList<long> TestObjectsAsRecyclableArrayList => _testObjectsAsRecyclableArrayList ?? throw new NullReferenceException("Something is wrong and the field is not initialized");
|
||||
protected RecyclableList<long>? _testObjectsAsRecyclableList;
|
||||
protected RecyclableList<long> TestObjectsAsRecyclableList => _testObjectsAsRecyclableList ?? throw new NullReferenceException("Something is wrong and the field is not initialized");
|
||||
protected RecyclableLongList<long>? _testObjectsAsRecyclableLongList;
|
||||
protected RecyclableLongList<long> TestObjectsAsRecyclableLongList => _testObjectsAsRecyclableLongList ?? throw new NullReferenceException("Something is wrong and the field is not initialized");
|
||||
protected IEnumerable<long> TestObjectsAsIEnumerable
|
||||
@@ -64,8 +64,8 @@ namespace Recyclable.Collections.Benchmarks
|
||||
_testObjectsAsPooledList ??= new PooledList<long>(TestObjects, ClearMode.Auto);
|
||||
break;
|
||||
|
||||
case RecyclableCollectionsBenchmarkSource.RecyclableArrayList:
|
||||
_testObjectsAsRecyclableArrayList ??= new(TestObjects, initialCapacity: TestObjectCount);
|
||||
case RecyclableCollectionsBenchmarkSource.RecyclableList:
|
||||
_testObjectsAsRecyclableList ??= new(TestObjects, initialCapacity: TestObjectCount);
|
||||
break;
|
||||
|
||||
case RecyclableCollectionsBenchmarkSource.RecyclableLongList:
|
||||
@@ -92,8 +92,8 @@ namespace Recyclable.Collections.Benchmarks
|
||||
_testObjectsAsList = default;
|
||||
_testObjectsAsPooledList?.Dispose();
|
||||
_testObjectsAsPooledList = default;
|
||||
_testObjectsAsRecyclableArrayList?.Dispose();
|
||||
_testObjectsAsRecyclableArrayList = default;
|
||||
_testObjectsAsRecyclableList?.Dispose();
|
||||
_testObjectsAsRecyclableList = default;
|
||||
_testObjectsAsRecyclableLongList?.Dispose();
|
||||
_testObjectsAsRecyclableLongList = default;
|
||||
base.Cleanup();
|
||||
@@ -104,11 +104,11 @@ namespace Recyclable.Collections.Benchmarks
|
||||
//public class ListVsLinkedListBenchmarks
|
||||
//{
|
||||
// [Benchmark]
|
||||
// public void RecyclableArrayList()
|
||||
// public void RecyclableList()
|
||||
// {
|
||||
// var data = TestObjects;
|
||||
// var dataCount = TestObjectCount;
|
||||
// using var list = new RecyclableArrayList<object>(initialCapacity: dataCount);
|
||||
// using var list = new RecyclableList<object>(initialCapacity: dataCount);
|
||||
// for (long i = 0; i < dataCount; i++)
|
||||
// {
|
||||
// list.Add(data[i]);
|
||||
|
||||
@@ -7,18 +7,18 @@
|
||||
| Array_Create_WithCapacity | 2,447.9 us | 8.35 us | 7.40 us | 1.99 | 0.02 | 58.5938 | 58.5938 | 58.5938 | 8000061 B | 137,932.09 |
|
||||
| List_Create_WithCapacity | 2,377.6 us | 43.03 us | 40.25 us | 1.93 | 0.03 | 54.6875 | 54.6875 | 54.6875 | 8000451 B | 137,938.81 |
|
||||
| PooledList_Create_WithCapacity | 1,229.4 us | 10.70 us | 9.48 us | 1.00 | 0.00 | - | - | - | 58 B | 1.00 |
|
||||
| RecyclableArrayList_Create_WithCapacity | 1,233.9 us | 3.93 us | 3.68 us | 1.00 | 0.01 | - | - | - | 41 B | 0.71 |
|
||||
| RecyclableList_Create_WithCapacity | 1,233.9 us | 3.93 us | 3.68 us | 1.00 | 0.01 | - | - | - | 41 B | 0.71 |
|
||||
| RecyclableLongList_Create_WithCapacity | 786.5 us | 2.32 us | 1.94 us | 0.64 | 0.01 | - | - | - | 425 B | 7.33 |
|
||||
|
||||
| List_Create | 3.5523 ns | 0.0181 ns | 0.0141 ns | 3.5476 ns | 0.000 | 0.00 | 0.0153 | - | - | 32 B | 0.000 |
|
||||
| PooledList_Create | 6.9236 ns | 0.0110 ns | 0.0098 ns | 6.9222 ns | 0.000 | 0.00 | 0.0268 | - | - | 56 B | 0.000 |
|
||||
| RecyclableArrayList_Create | 4.6451 ns | 0.0063 ns | 0.0053 ns | 4.6457 ns | 0.000 | 0.00 | 0.0191 | - | - | 40 B | 0.000 |
|
||||
| RecyclableList_Create | 4.6451 ns | 0.0063 ns | 0.0053 ns | 4.6457 ns | 0.000 | 0.00 | 0.0191 | - | - | 40 B | 0.000 |
|
||||
| RecyclableLongList_Create | 212.8164 ns | 11.9841 ns | 35.3355 ns | 213.2258 ns | 0.000 | 0.00 | 0.0381 | 0.0379 | - | 80 B | 0.000 |
|
||||
|
||||
Array_GetItem | 239.7 us | 0.36 us | 0.32 us | 0.66 | 0.00 | - | NA |
|
||||
List_GetItem | 363.5 us | 0.67 us | 0.56 us | 1.00 | 0.00 | - | NA |
|
||||
PooledList_GetItem | 365.3 us | 0.90 us | 0.75 us | 1.00 | 0.00 | - | NA |
|
||||
RecyclableArrayList_GetItem | 239.2 us | 0.07 us | 0.06 us | 0.65 | 0.00 | - | NA |
|
||||
RecyclableList_GetItem | 239.2 us | 0.07 us | 0.06 us | 0.65 | 0.00 | - | NA |
|
||||
RecyclableLongList_GetItem | 538.0 us | 1.01 us | 0.89 us | 1.47 | 0.00 | 1 B | NA |
|
||||
RecyclableLongList_GetItem_AsSpan | 673.5 us | 4.85 us | 4.30 us | 1.84 | 0.01 | 1 B | NA |
|
||||
RecyclableLongList_GetItem_AsArray | 239.4 us | 0.22 us | 0.20 us | 0.66 | 0.00 | - | NA |
|
||||
@@ -28,54 +28,54 @@
|
||||
| Array_SetItem | 2,576,086.8389 ns | 13,880.4584 ns | 11,590.8114 ns | 2,576,978.1250 ns | 2.194 | 0.01 | - | - | - | 2 B | 0.000 |
|
||||
| List_SetItem | 3,361,745.7734 ns | 98,390.1277 ns | 290,105.5114 ns | 3,505,120.8984 ns | 2.771 | 0.29 | - | - | - | 2 B | 0.000 |
|
||||
| PooledList_SetItem | 2,676,757.7524 ns | 1,228.8178 ns | 1,026.1185 ns | 2,676,991.4062 ns | 2.280 | 0.01 | - | - | - | 2 B | 0.000 |
|
||||
| RecyclableArrayList_SetItem | 2,547,059.6540 ns | 9,002.9953 ns | 7,980.9208 ns | 2,542,056.8359 ns | 2.170 | 0.01 | - | - | - | 2 B | 0.000 |
|
||||
| RecyclableList_SetItem | 2,547,059.6540 ns | 9,002.9953 ns | 7,980.9208 ns | 2,542,056.8359 ns | 2.170 | 0.01 | - | - | - | 2 B | 0.000 |
|
||||
| RecyclableLongList_SetItem | 2,326,771.9866 ns | 3,186.0942 ns | 2,824.3895 ns | 2,326,636.7188 ns | 1.981 | 0.01 | - | - | - | 2 B | 0.000 |
|
||||
|
||||
| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Gen1 | Gen2 | Allocated | Alloc Ratio |
|
||||
|------------------------------------------------------------ |----------:|----------:|----------:|------:|--------:|---------:|--------:|--------:|-----------:|------------:|
|
||||
| List_Add | 11.002 ms | 0.2189 ms | 0.2996 ms | 1.36 | 0.04 | 140.6250 | 93.7500 | 93.7500 | 16778117 B | 236,311.51 |
|
||||
| PooledList_Add | 8.117 ms | 0.0115 ms | 0.0102 ms | 1.00 | 0.00 | - | - | - | 71 B | 1.00 |
|
||||
| RecyclableArrayList_Add | 8.771 ms | 0.0169 ms | 0.0141 ms | 1.08 | 0.00 | - | - | - | 1233 B | 17.37 |
|
||||
| RecyclableList_Add | 8.771 ms | 0.0169 ms | 0.0141 ms | 1.08 | 0.00 | - | - | - | 1233 B | 17.37 |
|
||||
| RecyclableLongList_Add | 6.024 ms | 0.1101 ms | 0.1030 ms | 0.74 | 0.01 | - | - | - | 3317 B | 46.72 |
|
||||
|
||||
| List_Add_WithCapacity | 3,724,682.0668 ns | 88,719.4866 ns | 260,198.8962 ns | 3,717,873.0469 ns | 3.326 | 0.09 | 50.7813 | 50.7813 | 50.7813 | 4000368 B | 1.000 |
|
||||
| PooledList_Add_WithCapacity | 2,575,618.8337 ns | 5,277.9410 ns | 4,678.7572 ns | 2,575,805.2734 ns | 2.194 | 0.01 | - | - | - | 60 B | 0.000 |
|
||||
| RecyclableArrayList_Add_WithCapacity | 2,785,606.2500 ns | 4,595.4354 ns | 4,073.7338 ns | 2,785,292.7734 ns | 2.372 | 0.01 | - | - | - | 42 B | 0.000 |
|
||||
| RecyclableList_Add_WithCapacity | 2,785,606.2500 ns | 4,595.4354 ns | 4,073.7338 ns | 2,785,292.7734 ns | 2.372 | 0.01 | - | - | - | 42 B | 0.000 |
|
||||
| RecyclableLongList_Add_WithCapacity | 2,878,685.9701 ns | 44,974.7609 ns | 35,113.3350 ns | 2,873,102.9297 ns | 2.453 | 0.03 | - | - | - | 170 B | 0.000 |
|
||||
|
||||
| List_AddRangeWhenSourceIsArray | 1,966,607.1581 ns | 39,075.4380 ns | 100,165.2861 ns | 1,958,457.4219 ns | 1.721 | 0.07 | 42.9688 | 42.9688 | 42.9688 | 4000364 B | 1.000 |
|
||||
| PooledList_AddRangeWhenSourceIsArray | 972,973.4049 ns | 12,365.6121 ns | 11,566.8012 ns | 974,744.8242 ns | 0.829 | 0.01 | - | - | - | 57 B | 0.000 |
|
||||
| RecyclableArrayList_AddRangeWhenSourceIsArray | 1,098,651.7578 ns | 3,202.7829 ns | 2,995.8851 ns | 1,097,979.4922 ns | 0.936 | 0.00 | - | - | - | 41 B | 0.000 |
|
||||
| RecyclableList_AddRangeWhenSourceIsArray | 1,098,651.7578 ns | 3,202.7829 ns | 2,995.8851 ns | 1,097,979.4922 ns | 0.936 | 0.00 | - | - | - | 41 B | 0.000 |
|
||||
| RecyclableLongList_AddRangeWhenSourceIsArray | 1,023,799.0234 ns | 2,772.1984 ns | 2,457.4816 ns | 1,023,618.7500 ns | 0.872 | 0.00 | - | - | - | 169 B | 0.000 |
|
||||
|
||||
| List_AddRangeWhenSourceIsList | 1,954,805.9462 ns | 37,631.3829 ns | 71,597.6170 ns | 1,947,531.6406 ns | 1.656 | 0.06 | 42.9688 | 42.9688 | 42.9688 | 4000363 B | 1.000 |
|
||||
| PooledList_AddRangeWhenSourceIsList | 963,657.7116 ns | 5,594.8195 ns | 5,233.3976 ns | 965,055.4199 ns | 0.820 | 0.01 | - | - | - | 57 B | 0.000 |
|
||||
| RecyclableArrayList_AddRangeWhenSourceIsList | 1,114,697.8385 ns | 4,015.8164 ns | 3,756.3971 ns | 1,115,863.6719 ns | 0.950 | 0.00 | - | - | - | 41 B | 0.000 |
|
||||
| RecyclableList_AddRangeWhenSourceIsList | 1,114,697.8385 ns | 4,015.8164 ns | 3,756.3971 ns | 1,115,863.6719 ns | 0.950 | 0.00 | - | - | - | 41 B | 0.000 |
|
||||
| RecyclableLongList_AddRangeWhenSourceIsList | 1,008,424.0374 ns | 2,179.7502 ns | 1,932.2918 ns | 1,008,779.8828 ns | 0.859 | 0.00 | - | - | - | 169 B | 0.000 |
|
||||
|
||||
| List_AddRangeWhenSourceIsIList | 2,045,453.8895 ns | 40,653.4327 ns | 98,956.0738 ns | 2,040,041.7969 ns | 1.734 | 0.12 | 42.9688 | 42.9688 | 42.9688 | 4000366 B | 1.000 |
|
||||
| PooledList_AddRangeWhenSourceIsIList | 977,402.4790 ns | 4,165.1933 ns | 3,478.1251 ns | 978,420.3125 ns | 0.832 | 0.00 | - | - | - | 58 B | 0.000 |
|
||||
| RecyclableArrayList_AddRangeWhenSourceIsIList | 1,109,563.8477 ns | 4,480.2733 ns | 4,190.8505 ns | 1,108,281.9336 ns | 0.945 | 0.00 | - | - | - | 41 B | 0.000 |
|
||||
| RecyclableList_AddRangeWhenSourceIsIList | 1,109,563.8477 ns | 4,480.2733 ns | 4,190.8505 ns | 1,108,281.9336 ns | 0.945 | 0.00 | - | - | - | 41 B | 0.000 |
|
||||
| RecyclableLongList_AddRangeWhenSourceIsIList | 2,632,797.0052 ns | 3,899.2563 ns | 3,044.2828 ns | 2,632,267.1875 ns | 2.243 | 0.01 | - | - | - | 170 B | 0.000 |
|
||||
|
||||
| PooledList_AddRangeWhenSourceIsIEnumerable | 28,102,425.4630 ns | 556,294.1092 ns | 779,846.6478 ns | 28,009,543.7500 ns | 24.007 | 0.74 | 2187.5000 | 1375.0000 | 218.7500 | 12000526 B | 3.000 |
|
||||
| List_AddRangeWhenSourceIsIEnumerable | 47,884,030.8442 ns | 955,391.3313 ns | 1,370,193.6989 ns | 48,152,172.7273 ns | 40.578 | 1.04 | 2272.7273 | 1363.6364 | 363.6364 | 20389288 B | 5.097 |
|
||||
| RecyclableArrayList_AddRangeWhenSourceIsIEnumerable | 27,102,237.2533 ns | 535,598.7947 ns | 595,316.6412 ns | 27,248,382.8125 ns | 23.009 | 0.61 | 2250.0000 | 1406.2500 | 250.0000 | 12000305 B | 3.000 |
|
||||
| RecyclableList_AddRangeWhenSourceIsIEnumerable | 27,102,237.2533 ns | 535,598.7947 ns | 595,316.6412 ns | 27,248,382.8125 ns | 23.009 | 0.61 | 2250.0000 | 1406.2500 | 250.0000 | 12000305 B | 3.000 |
|
||||
| RecyclableLongList_AddRangeWhenSourceIsIEnumerable | 27,206,882.1023 ns | 517,997.7196 ns | 636,147.7188 ns | 27,262,153.1250 ns | 23.049 | 0.64 | 2218.7500 | 1468.7500 | 250.0000 | 12000361 B | 3.000 |
|
||||
|
||||
| PooledList_AddRangeWhenSourceIsPooledList | 958,132.3033 ns | 4,444.5508 ns | 3,939.9785 ns | 957,355.9570 ns | 0.816 | 0.00 | - | - | - | 57 B | 0.000 |
|
||||
| RecyclableArrayList_AddRangeWhenSourceIsRecyclableArrayList | 1,068,135.4492 ns | 15,036.9473 ns | 12,556.5320 ns | 1,063,337.2070 ns | 0.910 | 0.01 | - | - | - | 41 B | 0.000 |
|
||||
| RecyclableLongList_AddRangeWhenSourceIsRecyclableArrayList | 1,057,253.7249 ns | 2,697.5224 ns | 2,391.2834 ns | 1,057,475.9766 ns | 0.901 | 0.00 | - | - | - | 169 B | 0.000 |
|
||||
| RecyclableList_AddRangeWhenSourceIsRecyclableList | 1,068,135.4492 ns | 15,036.9473 ns | 12,556.5320 ns | 1,063,337.2070 ns | 0.910 | 0.01 | - | - | - | 41 B | 0.000 |
|
||||
| RecyclableLongList_AddRangeWhenSourceIsRecyclableList | 1,057,253.7249 ns | 2,697.5224 ns | 2,391.2834 ns | 1,057,475.9766 ns | 0.901 | 0.00 | - | - | - | 169 B | 0.000 |
|
||||
|
||||
| List_AddRange_WithCapacity | 2,022,247.3039 ns | 44,489.4467 ns | 129,071.9520 ns | 2,030,418.9453 ns | 1.767 | 0.06 | 39.0625 | 39.0625 | 39.0625 | 4000318 B | 1.000 |
|
||||
| PooledList_AddRange_WithCapacity | 965,635.9570 ns | 11,740.2154 ns | 10,981.8048 ns | 968,593.2617 ns | 0.822 | 0.01 | - | - | - | 57 B | 0.000 |
|
||||
| RecyclableArrayList_AddRange_WithCapacity | 1,044,438.5517 ns | 3,047.5353 ns | 2,544.8300 ns | 1,045,038.8672 ns | 0.890 | 0.00 | - | - | - | 41 B | 0.000 |
|
||||
| RecyclableList_AddRange_WithCapacity | 1,044,438.5517 ns | 3,047.5353 ns | 2,544.8300 ns | 1,045,038.8672 ns | 0.890 | 0.00 | - | - | - | 41 B | 0.000 |
|
||||
| RecyclableLongList_AddRange_WithCapacity | 1,028,953.5156 ns | 17,735.8499 ns | 14,810.2379 ns | 1,022,104.4922 ns | 0.876 | 0.01 | - | - | - | 169 B | 0.000 |
|
||||
|
||||
| Array_Count | 0.0087 ns | 0.0110 ns | 0.0103 ns | 0.0024 ns | 0.000 | 0.00 | - | - | - | - | 0.000 |
|
||||
| List_Count | 1.2190 ns | 0.0046 ns | 0.0040 ns | 1.2173 ns | 0.000 | 0.00 | - | - | - | - | 0.000 |
|
||||
| PooledList_Count | 0.0037 ns | 0.0015 ns | 0.0012 ns | 0.0040 ns | 0.000 | 0.00 | - | - | - | - | 0.000 |
|
||||
| RecyclableArrayList_Count | 1.2096 ns | 0.0009 ns | 0.0008 ns | 1.2092 ns | 0.000 | 0.00 | - | - | - | - | 0.000 |
|
||||
| RecyclableList_Count | 1.2096 ns | 0.0009 ns | 0.0008 ns | 1.2092 ns | 0.000 | 0.00 | - | - | - | - | 0.000 |
|
||||
| RecyclableLongList_Count | 0.0103 ns | 0.0008 ns | 0.0007 ns | 0.0102 ns | 0.000 | 0.00 | - | - | - | - | 0.000 |
|
||||
|
||||
| Array_LongCount | 0.0021 ns | 0.0005 ns | 0.0004 ns | 0.0022 ns | 0.000 | 0.00 | - | - | - | - | 0.000 |
|
||||
@@ -92,7 +92,7 @@
|
||||
| Array_IndexOf_FirstItems | 1,874,810,260.0000 ns | 25,774,115.5271 ns | 24,109,123.6555 ns | 1,867,388,700.0000 ns | 1,597.521 | 22.54 | - | - | - | 600 B | 0.000 |
|
||||
| List_IndexOf_FirstItems | 1,864,704,725.0000 ns | 10,982,470.8154 ns | 8,574,390.8164 ns | 1,866,253,200.0000 ns | 1,588.702 | 10.94 | - | - | - | 600 B | 0.000 |
|
||||
| PooledList_IndexOf_FirstItems | 1,840,856,800.0000 ns | 4,046,589.8784 ns | 3,159,311.2037 ns | 1,839,944,050.0000 ns | 1,568.374 | 6.17 | - | - | - | 600 B | 0.000 |
|
||||
| RecyclableArrayList_IndexOf_FirstItems | 1,832,934,950.0000 ns | 1,729,308.0131 ns | 1,350,129.9476 ns | 1,832,475,300.0000 ns | 1,561.625 | 5.52 | - | - | - | 600 B | 0.000 |
|
||||
| RecyclableList_IndexOf_FirstItems | 1,832,934,950.0000 ns | 1,729,308.0131 ns | 1,350,129.9476 ns | 1,832,475,300.0000 ns | 1,561.625 | 5.52 | - | - | - | 600 B | 0.000 |
|
||||
| RecyclableLongList_IndexOf_FirstItems | 1,844,986,792.3077 ns | 3,209,050.1952 ns | 2,679,702.2516 ns | 1,843,943,600.0000 ns | 1,571.359 | 6.49 | - | - | - | 600 B | 0.000 |
|
||||
| RecyclableLongList_LongIndexOf_FirstItems | 1,878,933,500.0000 ns | 17,118,131.6171 ns | 16,012,310.9355 ns | 1,870,009,600.0000 ns | 1,601.616 | 14.82 | - | - | - | 600 B | 0.000 |
|
||||
|
||||
@@ -103,20 +103,20 @@
|
||||
|
||||
| List_Remove_FirstItems | 5,023,030,012.5000 ns | 82,615,052.4052 ns | 107,422,903.9562 ns | 5,000,417,000.0000 ns | 4,295.171 | 116.37 | - | - | - | 4000656 B | 1.000 |
|
||||
| PooledList_Remove_FirstItems | 4,750,601,721.4286 ns | 17,989,258.8487 ns | 15,947,009.4038 ns | 4,747,622,550.0000 ns | 4,043.997 | 21.26 | - | - | - | 992 B | 0.000 |
|
||||
| RecyclableArrayList_Remove_FirstItems | 4,950,634,900.0000 ns | 33,761,094.2570 ns | 29,928,330.6849 ns | 4,936,519,050.0000 ns | 4,218.075 | 23.90 | - | - | - | 640 B | 0.000 |
|
||||
| RecyclableList_Remove_FirstItems | 4,950,634,900.0000 ns | 33,761,094.2570 ns | 29,928,330.6849 ns | 4,936,519,050.0000 ns | 4,218.075 | 23.90 | - | - | - | 640 B | 0.000 |
|
||||
| RecyclableLongList_Remove_FirstItems | 5,020,383,250.0000 ns | 100,209,734.5497 ns | 115,401,679.3276 ns | 5,029,163,750.0000 ns | 4,306.772 | 86.95 | - | - | - | 952 B | 0.000 |
|
||||
|
||||
| List_Remove_LastItems | 56,593,869,333.3333 ns | 258,693,958.6041 ns | 241,982,489.3835 ns | 56,513,091,800.0000 ns | 48,189.227 | 272.02 | - | - | - | 4000656 B | 1.000 |
|
||||
| PooledList_Remove_LastItems | 56,465,443,542.8571 ns | 99,443,506.1766 ns | 88,154,078.0245 ns | 56,458,364,050.0000 ns | 48,092.866 | 216.09 | - | - | - | 992 B | 0.000 |
|
||||
| RecyclableArrayList_Remove_LastItems | 57,432,405,146.6667 ns | 264,062,625.8226 ns | 247,004,344.0307 ns | 57,409,508,000.0000 ns | 48,952.707 | 234.83 | - | - | - | 640 B | 0.000 |
|
||||
| RecyclableList_Remove_LastItems | 57,432,405,146.6667 ns | 264,062,625.8226 ns | 247,004,344.0307 ns | 57,409,508,000.0000 ns | 48,952.707 | 234.83 | - | - | - | 640 B | 0.000 |
|
||||
| RecyclableLongList_Remove_LastItems | 57,077,678,728.5714 ns | 210,992,675.8689 ns | 187,039,511.4398 ns | 57,038,290,150.0000 ns | 48,614.503 | 242.79 | - | - | - | 952 B | 0.000 |
|
||||
|
||||
| List_RemoveAt_FirstItems | 4,517,669,893.3333 ns | 77,360,576.7460 ns | 72,363,131.4861 ns | 4,546,302,700.0000 ns | 3,850.590 | 62.34 | - | - | - | 4000656 B | 1.000 |
|
||||
| PooledList_RemoveAt_FirstItems | 4,439,417,700.0000 ns | 40,915,112.8948 ns | 38,272,021.9874 ns | 4,418,366,400.0000 ns | 3,779.751 | 38.92 | - | - | - | 992 B | 0.000 |
|
||||
| RecyclableArrayList_RemoveAt_FirstItems | 4,558,102,892.8571 ns | 25,076,973.8515 ns | 22,230,084.1404 ns | 4,559,174,800.0000 ns | 3,882.107 | 16.61 | - | - | - | 640 B | 0.000 |
|
||||
| RecyclableList_RemoveAt_FirstItems | 4,558,102,892.8571 ns | 25,076,973.8515 ns | 22,230,084.1404 ns | 4,559,174,800.0000 ns | 3,882.107 | 16.61 | - | - | - | 640 B | 0.000 |
|
||||
| RecyclableLongList_RemoveAt_FirstItems | 4,617,033,766.6667 ns | 85,061,197.3076 ns | 79,566,296.7373 ns | 4,632,994,800.0000 ns | 3,928.768 | 72.17 | - | - | - | 952 B | 0.000 |
|
||||
|
||||
| List_RemoveAt_LastItems | 2,005,211.3281 ns | 40,078.0351 ns | 84,538.1787 ns | 2,010,579.1016 ns | 1.725 | 0.08 | 42.9688 | 42.9688 | 42.9688 | 4000306 B | 1.000 |
|
||||
| PooledList_RemoveAt_LastItems | 1,047,436.1654 ns | 5,655.2027 ns | 5,289.8801 ns | 1,044,690.9180 ns | 0.892 | 0.01 | - | - | - | 58 B | 0.000 |
|
||||
| RecyclableArrayList_RemoveAt_LastItems | 1,256,380.8969 ns | 9,142.3285 ns | 7,634.2584 ns | 1,254,354.9805 ns | 1.070 | 0.01 | - | - | - | 41 B | 0.000 |
|
||||
| RecyclableList_RemoveAt_LastItems | 1,256,380.8969 ns | 9,142.3285 ns | 7,634.2584 ns | 1,254,354.9805 ns | 1.070 | 0.01 | - | - | - | 41 B | 0.000 |
|
||||
| RecyclableLongList_RemoveAt_LastItems | 1,621,193.5826 ns | 20,030.6198 ns | 17,756.6227 ns | 1,620,789.8438 ns | 1.379 | 0.02 | - | - | - | 353 B | 0.000 |
|
||||
@@ -5,4 +5,4 @@
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "<Pending>", Scope = "member", Target = "~F:Recyclable.Collections.RecyclableArrayList`1._count")]
|
||||
[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "<Pending>", Scope = "member", Target = "~F:Recyclable.Collections.RecyclableList`1._count")]
|
||||
@@ -7,10 +7,10 @@ namespace Recyclable.Collections
|
||||
public static class ListExtensions
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool Contains<T>(this RecyclableArrayList<T[]> arrays, T item) => arrays.Any(x => x.Contains(item));
|
||||
public static bool Contains<T>(this RecyclableList<T[]> arrays, T item) => arrays.Any(x => x.Contains(item));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void CopyTo<T>(this RecyclableArrayList<T[]> arrays, long startingIndex, int blockSize, int lastBlockSize, T[] destinationArray, int destinationArrayIndex)
|
||||
public static void CopyTo<T>(this RecyclableList<T[]> arrays, long startingIndex, int blockSize, int lastBlockSize, T[] destinationArray, int destinationArrayIndex)
|
||||
{
|
||||
Span<T> arrayMemory = destinationArray.AsSpan();
|
||||
arrayMemory = arrayMemory[destinationArrayIndex..];
|
||||
@@ -49,7 +49,7 @@ namespace Recyclable.Collections
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static IEnumerable<T> Enumerate<T>(this RecyclableArrayList<T[]> arrays, int chunkSize, long totalCount)
|
||||
public static IEnumerable<T> Enumerate<T>(this RecyclableList<T[]> arrays, int chunkSize, long totalCount)
|
||||
{
|
||||
long currentCount = 0;
|
||||
for (var arrayIdx = 0; (arrayIdx < arrays.Count) && (currentCount < totalCount); arrayIdx++)
|
||||
@@ -104,7 +104,7 @@ namespace Recyclable.Collections
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static long LongIndexOf<T>(this RecyclableArrayList<T[]> arrays, int blockSize, T item, IEqualityComparer<T> comparer)
|
||||
public static long LongIndexOf<T>(this RecyclableList<T[]> arrays, int blockSize, T item, IEqualityComparer<T> comparer)
|
||||
{
|
||||
for (var arrayIdx = 0; arrayIdx < arrays.Count; arrayIdx++)
|
||||
{
|
||||
|
||||
+15
-15
@@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Recyclable.Collections
|
||||
{
|
||||
public class RecyclableArrayList<T> : IList<T>, IDisposable
|
||||
public class RecyclableList<T> : IList<T>, IDisposable
|
||||
{
|
||||
private static readonly ArrayPool<T> _arrayPool = ArrayPool<T>.Create();
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Recyclable.Collections
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
protected static int EnsureCapacity(RecyclableArrayList<T> list, int requestedCapacity)
|
||||
protected static int EnsureCapacity(RecyclableList<T> list, int requestedCapacity)
|
||||
{
|
||||
int newCapacity;
|
||||
switch (list._capacity > 0)
|
||||
@@ -69,13 +69,13 @@ namespace Recyclable.Collections
|
||||
}
|
||||
|
||||
#pragma warning disable CS8618 // _memory will be initialized when the 1st item is added
|
||||
public RecyclableArrayList()
|
||||
public RecyclableList()
|
||||
#pragma warning restore CS8618
|
||||
{
|
||||
}
|
||||
|
||||
#pragma warning disable CS8618 // _memory will be initialized when the 1st item is added
|
||||
public RecyclableArrayList(int initialCapacity)
|
||||
public RecyclableList(int initialCapacity)
|
||||
#pragma warning restore CS8618
|
||||
{
|
||||
if (initialCapacity > 0)
|
||||
@@ -86,34 +86,34 @@ namespace Recyclable.Collections
|
||||
}
|
||||
|
||||
#pragma warning disable CS8618 // _memory will be initialized when the 1st item is added
|
||||
public RecyclableArrayList(RecyclableArrayList<T> source)
|
||||
public RecyclableList(RecyclableList<T> source)
|
||||
#pragma warning restore CS8618
|
||||
{
|
||||
AddRange(source);
|
||||
}
|
||||
|
||||
#pragma warning disable CS8618 // _memory will be initialized when the 1st item is added
|
||||
public RecyclableArrayList(in T[] source)
|
||||
public RecyclableList(in T[] source)
|
||||
#pragma warning restore CS8618
|
||||
{
|
||||
AddRange(source);
|
||||
}
|
||||
|
||||
#pragma warning disable CS8618 // _memory will be initialized when the 1st item is added
|
||||
public RecyclableArrayList(List<T> source)
|
||||
public RecyclableList(List<T> source)
|
||||
#pragma warning restore CS8618
|
||||
{
|
||||
AddRange(source);
|
||||
}
|
||||
|
||||
#pragma warning disable CS8618 // _memory will be initialized when the 1st item is added
|
||||
public RecyclableArrayList(IList<T> source)
|
||||
public RecyclableList(IList<T> source)
|
||||
#pragma warning restore CS8618
|
||||
{
|
||||
AddRange(source);
|
||||
}
|
||||
|
||||
public RecyclableArrayList(IEnumerable<T> source, int initialCapacity = RecyclableDefaults.Capacity)
|
||||
public RecyclableList(IEnumerable<T> source, int initialCapacity = RecyclableDefaults.Capacity)
|
||||
{
|
||||
_memoryBlock = Resize(_memoryBlock, initialCapacity);
|
||||
_capacity = _memoryBlock.Length;
|
||||
@@ -227,7 +227,7 @@ namespace Recyclable.Collections
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
public void AddRange(RecyclableArrayList<T> items)
|
||||
public void AddRange(RecyclableList<T> items)
|
||||
{
|
||||
if (items.Count == 0)
|
||||
{
|
||||
@@ -258,12 +258,12 @@ namespace Recyclable.Collections
|
||||
var sourceItemsCount = items.LongCount;
|
||||
if (sourceItemsCount > int.MaxValue)
|
||||
{
|
||||
ThrowArgumentOutOfRangeException($"The number of items exceeds the maximum capacity of {nameof(RecyclableArrayList<T>)}, equal {int.MaxValue}, equal {int.MaxValue}. Please consider using {nameof(RecyclableLongList<T>)}, instead");
|
||||
ThrowArgumentOutOfRangeException($"The number of items exceeds the maximum capacity of {nameof(RecyclableList<T>)}, equal {int.MaxValue}, equal {int.MaxValue}. Please consider using {nameof(RecyclableLongList<T>)}, instead");
|
||||
}
|
||||
|
||||
if (_count + sourceItemsCount > int.MaxValue)
|
||||
{
|
||||
ThrowArgumentOutOfRangeException($"The total number of items in source and target table exceeds the maximum capacity of {nameof(RecyclableArrayList<T>)}, equal {int.MaxValue}. Please consider using {nameof(RecyclableLongList<T>)}, instead");
|
||||
ThrowArgumentOutOfRangeException($"The total number of items in source and target table exceeds the maximum capacity of {nameof(RecyclableList<T>)}, equal {int.MaxValue}. Please consider using {nameof(RecyclableLongList<T>)}, instead");
|
||||
}
|
||||
|
||||
int targetCapacity = _count + (int)sourceItemsCount;
|
||||
@@ -315,9 +315,9 @@ namespace Recyclable.Collections
|
||||
return;
|
||||
}
|
||||
|
||||
if (source is RecyclableArrayList<T> sourceRecyclableArrayList)
|
||||
if (source is RecyclableList<T> sourceRecyclableList)
|
||||
{
|
||||
AddRange(sourceRecyclableArrayList);
|
||||
AddRange(sourceRecyclableList);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ namespace Recyclable.Collections
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
public void CopyTo(T[] array, int arrayIndex) => Array.Copy(_memoryBlock, 0, array, arrayIndex, _count);
|
||||
|
||||
protected static IEnumerable<T> Enumerate(RecyclableArrayList<T> list)
|
||||
protected static IEnumerable<T> Enumerate(RecyclableList<T> list)
|
||||
{
|
||||
int count = list._count;
|
||||
var memory = list._memoryBlock;
|
||||
@@ -525,7 +525,7 @@ namespace Recyclable.Collections
|
||||
_lastBlockWithData = targetBlockIndex - (itemsSpan.Length > 0 ? 0 : 1);
|
||||
}
|
||||
|
||||
public void AddRange(RecyclableArrayList<T> items)
|
||||
public void AddRange(RecyclableList<T> items)
|
||||
{
|
||||
if (items.Count == 0)
|
||||
{
|
||||
@@ -747,9 +747,9 @@ namespace Recyclable.Collections
|
||||
return;
|
||||
}
|
||||
|
||||
if (source is RecyclableArrayList<T> sourceRecyclableArrayList)
|
||||
if (source is RecyclableList<T> sourceRecyclableList)
|
||||
{
|
||||
AddRange(sourceRecyclableArrayList);
|
||||
AddRange(sourceRecyclableList);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,16 +132,16 @@ namespace Recyclable.Collections
|
||||
public static RecyclableLongList<T> ToRecyclableLongList<T>(this List<T> values, int blockSize = RecyclableDefaults.BlockSize) => new(values, blockSize);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static RecyclableArrayList<T> ToRecyclableArrayList<T>(this IEnumerable<T> values) => new(values);
|
||||
public static RecyclableList<T> ToRecyclableList<T>(this IEnumerable<T> values) => new(values);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static RecyclableArrayList<T> ToRecyclableArrayList<T>(this T[] values) => new(values);
|
||||
public static RecyclableList<T> ToRecyclableList<T>(this T[] values) => new(values);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static RecyclableArrayList<T> ToRecyclableArrayList<T>(this List<T> values) => new(values);
|
||||
public static RecyclableList<T> ToRecyclableList<T>(this List<T> values) => new(values);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static RecyclableArrayList<T> ToRecyclableArrayList<T>(this RecyclableArrayList<T> values) => new(values);
|
||||
public static RecyclableList<T> ToRecyclableList<T>(this RecyclableList<T> values) => new(values);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static RecyclableLongList<T> ToRecyclableLongList<T>(this IEnumerable<T> values, int minBlockSize = RecyclableDefaults.BlockSize) => new(values, minBlockSize: minBlockSize);
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Recyclable.Collections
|
||||
private static readonly IEqualityComparer<T> _equalityComparer = EqualityComparer<T>.Default;
|
||||
|
||||
private bool _disposedValue;
|
||||
private RecyclableArrayList<T[]> Memory { get; }
|
||||
private RecyclableList<T[]> Memory { get; }
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static T Dequeue(RecyclableQueue<T> queue)
|
||||
|
||||
+33
-33
@@ -3,14 +3,14 @@ using Recyclable.Collections;
|
||||
|
||||
namespace Recyclable.CollectionsTests
|
||||
{
|
||||
public class RecyclableArrayListTests
|
||||
public class RecyclableListTests
|
||||
{
|
||||
[Theory]
|
||||
[MemberData(nameof(RecyclableLongListTestData.SourceDataVariants), MemberType = typeof(RecyclableLongListTestData))]
|
||||
public void AddRangeShouldAddItemsInCorrectOrder(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>();
|
||||
using var list = new RecyclableList<long>();
|
||||
|
||||
// Act
|
||||
if (testData is long[] testDataArray)
|
||||
@@ -21,9 +21,9 @@ namespace Recyclable.CollectionsTests
|
||||
{
|
||||
list.AddRange(testDataList);
|
||||
}
|
||||
else if (testData is RecyclableArrayList<long> testDataRecyclableArrayList)
|
||||
else if (testData is RecyclableList<long> testDataRecyclableList)
|
||||
{
|
||||
list.AddRange(testDataRecyclableArrayList);
|
||||
list.AddRange(testDataRecyclableList);
|
||||
}
|
||||
else if (testData is RecyclableLongList<long> testDataRecyclableLongList)
|
||||
{
|
||||
@@ -53,7 +53,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void AddRangeShouldDoNothingWhenSourceIsEmpty(string testCase, IEnumerable<long> testData)
|
||||
{
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>();
|
||||
using var list = new RecyclableList<long>();
|
||||
|
||||
// Act
|
||||
if (testData is long[] testDataArray)
|
||||
@@ -64,9 +64,9 @@ namespace Recyclable.CollectionsTests
|
||||
{
|
||||
list.AddRange(testDataList);
|
||||
}
|
||||
else if (testData is RecyclableArrayList<long> testDataRecyclableArrayList)
|
||||
else if (testData is RecyclableList<long> testDataRecyclableList)
|
||||
{
|
||||
list.AddRange(testDataRecyclableArrayList);
|
||||
list.AddRange(testDataRecyclableList);
|
||||
}
|
||||
else if (testData is RecyclableLongList<long> testDataRecyclableLongList)
|
||||
{
|
||||
@@ -96,7 +96,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void AddRangeShouldNotOverrideItems(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>();
|
||||
using var list = new RecyclableList<long>();
|
||||
|
||||
// Act
|
||||
if (testData is long[] testDataArray)
|
||||
@@ -109,10 +109,10 @@ namespace Recyclable.CollectionsTests
|
||||
list.AddRange(testDataList);
|
||||
list.AddRange(testDataList);
|
||||
}
|
||||
else if (testData is RecyclableArrayList<long> testDataRecyclableArrayList)
|
||||
else if (testData is RecyclableList<long> testDataRecyclableList)
|
||||
{
|
||||
list.AddRange(testDataRecyclableArrayList);
|
||||
list.AddRange(testDataRecyclableArrayList);
|
||||
list.AddRange(testDataRecyclableList);
|
||||
list.AddRange(testDataRecyclableList);
|
||||
}
|
||||
else if (testData is RecyclableLongList<long> testDataRecyclableLongList)
|
||||
{
|
||||
@@ -154,7 +154,7 @@ namespace Recyclable.CollectionsTests
|
||||
testData = testData.Concat(testData).ToArray();
|
||||
|
||||
// Act
|
||||
using var list = new RecyclableArrayList<long>();
|
||||
using var list = new RecyclableList<long>();
|
||||
foreach (var index in testData)
|
||||
{
|
||||
list.Add(index);
|
||||
@@ -170,7 +170,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void AddShouldAddItems(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>();
|
||||
using var list = new RecyclableList<long>();
|
||||
|
||||
// Act
|
||||
foreach (var item in testData)
|
||||
@@ -190,7 +190,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void AddShouldAddItemWhenAfterAddRange(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Act
|
||||
using var list = new RecyclableArrayList<long>();
|
||||
using var list = new RecyclableList<long>();
|
||||
list.AddRange(testData);
|
||||
foreach (var index in testData)
|
||||
{
|
||||
@@ -207,7 +207,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void ClearShouldRemoveAllItems(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>(testData);
|
||||
using var list = new RecyclableList<long>(testData);
|
||||
_ = list.Count.Should().Be((int)itemsCount);
|
||||
|
||||
// Act
|
||||
@@ -224,7 +224,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void ConsecutiveDisposeShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>(testData);
|
||||
using var list = new RecyclableList<long>(testData);
|
||||
list.Dispose();
|
||||
|
||||
// Act
|
||||
@@ -236,7 +236,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void ConstructorShouldAcceptDuplicates(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Act
|
||||
using var list = new RecyclableArrayList<long>(testData.Concat(testData), initialCapacity: (int)itemsCount * 2);
|
||||
using var list = new RecyclableList<long>(testData.Concat(testData), initialCapacity: (int)itemsCount * 2);
|
||||
|
||||
// Validate
|
||||
_ = list.Count.Should().Be((int)itemsCount * 2);
|
||||
@@ -248,7 +248,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void ConstructorShouldAddItemsInCorrectOrderWhenSourceIsIEnumerable(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Act
|
||||
using var list = new RecyclableArrayList<long>(testData);
|
||||
using var list = new RecyclableList<long>(testData);
|
||||
|
||||
// Validate
|
||||
_ = list.Capacity.Should().BeGreaterThanOrEqualTo((int)itemsCount, "when we succeed in taking count without enumerating, then we allocate as much memory as needed, only");
|
||||
@@ -261,7 +261,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void ConstructorSourceShouldInitializeList(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Act
|
||||
using var list = new RecyclableArrayList<long>(testData);
|
||||
using var list = new RecyclableList<long>(testData);
|
||||
|
||||
// Validate
|
||||
_ = list.Count.Should().Be((int)itemsCount);
|
||||
@@ -278,7 +278,7 @@ namespace Recyclable.CollectionsTests
|
||||
}
|
||||
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>(testData);
|
||||
using var list = new RecyclableList<long>(testData);
|
||||
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
||||
|
||||
// Act
|
||||
@@ -293,7 +293,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void ContainsShouldNotFindAnythingWhenListEmpty()
|
||||
{
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<int>();
|
||||
using var list = new RecyclableList<int>();
|
||||
|
||||
// Validate
|
||||
_ = list.Contains(0).Should().BeFalse();
|
||||
@@ -310,7 +310,7 @@ namespace Recyclable.CollectionsTests
|
||||
}
|
||||
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>(testData);
|
||||
using var list = new RecyclableList<long>(testData);
|
||||
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
||||
|
||||
// Act
|
||||
@@ -329,7 +329,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void CopyToShouldCopyAllItemsInTheCorrectOrder(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>(testData);
|
||||
using var list = new RecyclableList<long>(testData);
|
||||
long[] copiedItems = new long[itemsCount];
|
||||
|
||||
// Act
|
||||
@@ -345,7 +345,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void EnumerateShouldYieldAllItemsInCorrectOrder(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>(testData);
|
||||
using var list = new RecyclableList<long>(testData);
|
||||
|
||||
// Act
|
||||
var yieldedItems = new List<long>((int)itemsCount);
|
||||
@@ -360,7 +360,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void IndexOfShouldNotFindAnythingWhenListEmpty()
|
||||
{
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<int>();
|
||||
using var list = new RecyclableList<int>();
|
||||
|
||||
// Validate
|
||||
_ = list.IndexOf(0).Should().Be(-1);
|
||||
@@ -379,7 +379,7 @@ namespace Recyclable.CollectionsTests
|
||||
}
|
||||
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>(testData);
|
||||
using var list = new RecyclableList<long>(testData);
|
||||
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
||||
|
||||
// Act
|
||||
@@ -398,7 +398,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void IndexOfShouldReturnCorrectIndexes(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>(testData);
|
||||
using var list = new RecyclableList<long>(testData);
|
||||
|
||||
// Act & Validate
|
||||
foreach (var index in testData)
|
||||
@@ -418,7 +418,7 @@ namespace Recyclable.CollectionsTests
|
||||
}
|
||||
|
||||
// Act
|
||||
using RecyclableArrayList<long> list = new(testData);
|
||||
using RecyclableList<long> list = new(testData);
|
||||
list.QuickSort();
|
||||
|
||||
// Validate
|
||||
@@ -451,7 +451,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void InsertAtTheBeginningShouldMoveItems(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>();
|
||||
using var list = new RecyclableList<long>();
|
||||
|
||||
// Act
|
||||
foreach (var item in testData)
|
||||
@@ -471,7 +471,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void RemoveAtFromTheBeginningShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>(testData);
|
||||
using var list = new RecyclableList<long>(testData);
|
||||
|
||||
// Act & Validate
|
||||
for (var deleted = 1; deleted <= itemsCount; deleted++)
|
||||
@@ -493,7 +493,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void RemoveAtFromTheEndShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>(testData);
|
||||
using var list = new RecyclableList<long>(testData);
|
||||
|
||||
// Act & Validate
|
||||
for (var deleted = 1; deleted <= itemsCount; deleted++)
|
||||
@@ -515,7 +515,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void RemoveFromTheBeginningShouldRemoveTheCorrectItem(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Prepare
|
||||
using var list = new RecyclableArrayList<long>(testData);
|
||||
using var list = new RecyclableList<long>(testData);
|
||||
|
||||
// Act & Validate
|
||||
for (var deleted = 1; deleted <= itemsCount; deleted++)
|
||||
@@ -534,7 +534,7 @@ namespace Recyclable.CollectionsTests
|
||||
public void RemoveFromTheEndShouldRemoveTheCorrectItem(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||
{
|
||||
// Act & Validate
|
||||
using var list = new RecyclableArrayList<long>(testData);
|
||||
using var list = new RecyclableList<long>(testData);
|
||||
long deleted = 0;
|
||||
foreach (var item in testData.Reverse())
|
||||
{
|
||||
@@ -45,7 +45,7 @@ namespace Recyclable.CollectionsTests
|
||||
{
|
||||
yield return new object[] { $"int[{itemsCount}]", CreateTestData(itemsCount).ToArray(), itemsCount };
|
||||
yield return new object[] { $"List<int>(itemsCount: {itemsCount}", CreateTestData(itemsCount).ToList(), itemsCount };
|
||||
yield return new object[] { $"RecyclableArrayList<int>(itemsCount: {itemsCount})", CreateTestData(itemsCount).ToRecyclableArrayList(), itemsCount };
|
||||
yield return new object[] { $"RecyclableList<int>(itemsCount: {itemsCount})", CreateTestData(itemsCount).ToRecyclableList(), itemsCount };
|
||||
foreach (var sourceBlockSize in BlockSizeVariants)
|
||||
{
|
||||
yield return new object[]
|
||||
@@ -68,7 +68,7 @@ namespace Recyclable.CollectionsTests
|
||||
{
|
||||
new object[] { "int[]", Array.Empty<long>() },
|
||||
new object[] { "List<int>", Array.Empty<long>().ToList() },
|
||||
new object[] { "RecyclableArrayList<int>", Array.Empty<long>().ToRecyclableArrayList() },
|
||||
new object[] { "RecyclableList<int>", Array.Empty<long>().ToRecyclableList() },
|
||||
new object[] { "RecyclableLongList<int>", Array.Empty<long>().ToRecyclableLongList() },
|
||||
new object[] { "IList<int>", new CustomIList<long>(Array.Empty<long>()) },
|
||||
new object[] { "IEnumerable<int> with non-enumerated count", Array.Empty<long>().AsEnumerable() },
|
||||
|
||||
@@ -21,9 +21,9 @@ namespace Recyclable.CollectionsTests
|
||||
{
|
||||
list.AddRange(testDataList);
|
||||
}
|
||||
else if (testData is RecyclableArrayList<long> testDataRecyclableArrayList)
|
||||
else if (testData is RecyclableList<long> testDataRecyclableList)
|
||||
{
|
||||
list.AddRange(testDataRecyclableArrayList);
|
||||
list.AddRange(testDataRecyclableList);
|
||||
}
|
||||
else if (testData is RecyclableLongList<long> testDataRecyclableList)
|
||||
{
|
||||
@@ -65,9 +65,9 @@ namespace Recyclable.CollectionsTests
|
||||
{
|
||||
list.AddRange(testDataList);
|
||||
}
|
||||
else if (testData is RecyclableArrayList<long> testDataRecyclableArrayList)
|
||||
else if (testData is RecyclableList<long> testDataRecyclableList)
|
||||
{
|
||||
list.AddRange(testDataRecyclableArrayList);
|
||||
list.AddRange(testDataRecyclableList);
|
||||
}
|
||||
else if (testData is RecyclableLongList<long> testDataRecyclableList)
|
||||
{
|
||||
@@ -110,15 +110,15 @@ namespace Recyclable.CollectionsTests
|
||||
list.AddRange(testDataList);
|
||||
list.AddRange(testDataList);
|
||||
}
|
||||
else if (testData is RecyclableArrayList<long> testDataRecyclableArrayList)
|
||||
else if (testData is RecyclableList<long> testDataRecyclableList)
|
||||
{
|
||||
list.AddRange(testDataRecyclableArrayList);
|
||||
list.AddRange(testDataRecyclableArrayList);
|
||||
list.AddRange(testDataRecyclableList);
|
||||
list.AddRange(testDataRecyclableList);
|
||||
}
|
||||
else if (testData is RecyclableLongList<long> testDataRecyclableList)
|
||||
else if (testData is RecyclableLongList<long> testDataRecyclableLongList)
|
||||
{
|
||||
list.AddRange(testDataRecyclableList);
|
||||
list.AddRange(testDataRecyclableList);
|
||||
list.AddRange(testDataRecyclableLongList);
|
||||
list.AddRange(testDataRecyclableLongList);
|
||||
}
|
||||
else if (testData is IList<long> testDataIList)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user