Solutions from RecyclableArreyList were copied to RecylableList. Initial version.
This commit is contained in:
1 parent
0c3847a9bf
commit
6ef79d2203
11 files changed
+453
-229
No files matched your search
@@ -4,8 +4,8 @@ namespace Recyclable.Collections.Benchmarks
|
||||
{
|
||||
public class BenchmarkBase
|
||||
{
|
||||
[Params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 128, 256, 512, 1024, 2048, 4096, 8192, 1_000_000)]
|
||||
public int TestObjectCount = 1; // = 1_000_000;
|
||||
//[Params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 128, 256, 512, 1024, 2048, 4096, 8192, 1_000_000)]
|
||||
public int TestObjectCount = 1_000_000;
|
||||
public int BlockSize => TestObjectCount switch
|
||||
{
|
||||
0 => 1,
|
||||
|
||||
@@ -3,12 +3,14 @@ using Recyclable.Collections.Benchmarks;
|
||||
|
||||
//BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(new[] { "-f*" });
|
||||
|
||||
BenchmarkRunner.Run<RecyclableCollectionsBenchmarks>();
|
||||
//BenchmarkRunner.Run<RecyclableCollectionsBenchmarks>();
|
||||
//BenchmarkRunner.Run<RefVsInstanceMemberBenchmarks>();
|
||||
|
||||
//var benchmark = new RecyclableCollectionsBenchmarks();
|
||||
var benchmark = new RecyclableCollectionsBenchmarks();
|
||||
benchmark.Setup();
|
||||
//benchmark.RecyclableArrayList_AddRange_WithCapacity();
|
||||
//benchmark.RecyclableArrayList_Add_WithCapacity();
|
||||
benchmark.RecyclableList_Add();
|
||||
|
||||
|
||||
//BenchmarkRunner.Run<DelegateVsComparerBenchmark>();
|
||||
|
||||
@@ -4,14 +4,14 @@ namespace Recyclable.Collections.Benchmarks
|
||||
{
|
||||
public partial class RecyclableCollectionsBenchmarks : BenchmarkBase
|
||||
{
|
||||
//[Benchmark(Baseline = true)]
|
||||
[Benchmark(Baseline = true)]
|
||||
public void List_Create()
|
||||
{
|
||||
var list = new List<object>();
|
||||
DoNothing(list);
|
||||
}
|
||||
|
||||
//[Benchmark]
|
||||
[Benchmark]
|
||||
public void List_Create_WithCapacity()
|
||||
{
|
||||
var list = new List<object>(TestObjectCount);
|
||||
@@ -30,7 +30,7 @@ namespace Recyclable.Collections.Benchmarks
|
||||
}
|
||||
}
|
||||
|
||||
[Benchmark(Baseline = true)]
|
||||
[Benchmark(Baseline = false)]
|
||||
public void List_Add_WithCapacity()
|
||||
{
|
||||
var data = TestObjects;
|
||||
|
||||
+2
-2
@@ -31,14 +31,14 @@ namespace Recyclable.Collections.Benchmarks
|
||||
_testObjects = default;
|
||||
}
|
||||
|
||||
//[Benchmark]
|
||||
[Benchmark]
|
||||
public void RecyclableArrayList_Create()
|
||||
{
|
||||
using var list = new RecyclableArrayList<object>();
|
||||
DoNothing(list);
|
||||
}
|
||||
|
||||
//[Benchmark]
|
||||
[Benchmark]
|
||||
public void RecyclableArrayList_Create_WithCapacity()
|
||||
{
|
||||
using var list = new RecyclableArrayList<object>(TestObjectCount);
|
||||
|
||||
+5
-12
@@ -6,28 +6,21 @@ namespace Recyclable.Collections.Benchmarks
|
||||
{
|
||||
private RecyclableList<object> _testRecyclableList;
|
||||
|
||||
//[Benchmark]
|
||||
[Benchmark]
|
||||
public void RecyclableList_Create()
|
||||
{
|
||||
using var list = new RecyclableList<object>();
|
||||
DoNothing(list);
|
||||
}
|
||||
|
||||
//[Benchmark]
|
||||
public void RecyclableList_Create_0Capacity()
|
||||
{
|
||||
using var list = new RecyclableList<object>(totalItemsCount: 0);
|
||||
DoNothing(list);
|
||||
}
|
||||
|
||||
//[Benchmark]
|
||||
[Benchmark]
|
||||
public void RecyclableList_Create_WithCapacity()
|
||||
{
|
||||
using var list = new RecyclableList<object>(totalItemsCount: TestObjectCount);
|
||||
using var list = new RecyclableList<object>(initialCapacity: TestObjectCount);
|
||||
DoNothing(list);
|
||||
}
|
||||
|
||||
//[Benchmark]
|
||||
[Benchmark]
|
||||
public void RecyclableList_Add()
|
||||
{
|
||||
var data = TestObjects;
|
||||
@@ -39,7 +32,7 @@ namespace Recyclable.Collections.Benchmarks
|
||||
}
|
||||
}
|
||||
|
||||
//[Benchmark]
|
||||
[Benchmark]
|
||||
public void RecyclableList_Add_WithCapacity()
|
||||
{
|
||||
var data = TestObjects;
|
||||
|
||||
Reference in new issue
Block a user