Test data item type changed to "long" for performance reasons.
This commit is contained in:
1 parent
abfe476573
commit
c45af6a884
20 files changed
+97
-99
No files matched your search
@@ -13,17 +13,16 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
|
||||
private const int _maxArraySize = 2_147_483_605;
|
||||
|
||||
|
||||
[Benchmark(OperationsPerInvoke = 1)]
|
||||
public void Max_Allowed_Size_2_147_483_605()
|
||||
{
|
||||
var arr = ArrayPool<object>.Shared.Rent(_maxArraySize);
|
||||
var arr = ArrayPool<long>.Shared.Rent(_maxArraySize);
|
||||
}
|
||||
|
||||
[Benchmark(OperationsPerInvoke = 1)]
|
||||
public void FindArraySizeLimit()
|
||||
{
|
||||
var pool = ArrayPool<object>.Shared;
|
||||
var pool = ArrayPool<long>.Shared;
|
||||
var bufferSize = int.MaxValue / 2;
|
||||
var oldValue = 0;
|
||||
while (true)
|
||||
@@ -31,7 +30,7 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
try
|
||||
{
|
||||
Console.Write($"Allocating {bufferSize}...");
|
||||
var arr = pool.Rent((int)bufferSize);
|
||||
var arr = pool.Rent(bufferSize);
|
||||
Console.WriteLine("success");
|
||||
pool.Return(arr);
|
||||
arr = null;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
//[Params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 30, 32, 40, 50, 60, 80, 90, 100, 128, 256, 512, 1024, 2048, 4096, 8192, 1_000_000)]
|
||||
//[Params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 30, 32, 40, 50, 60, 80, 90, 100, 128, 256, 512, 1024, 2048, 4096, 8192, 1_000_000)]
|
||||
public long TestObjectCount = 1_000_000;
|
||||
public int TestObjectCount = 1_000_000;
|
||||
|
||||
//[Params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200)]
|
||||
//[Params(10, 20, 50, 100)]
|
||||
|
||||
+10
-11
@@ -1845,47 +1845,46 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
#endregion
|
||||
public partial class RecyclableListPocBenchmarks
|
||||
{
|
||||
|
||||
[Benchmark(Baseline = false)]
|
||||
public void RecyclableList_EnsureCapacityV1_ByPowOf2()
|
||||
{
|
||||
using var list = new RecyclableListV1<object>(minBlockSize: BlockSize, expectedItemsCount: TestObjectCount);
|
||||
using var list = new RecyclableListV1<long>(minBlockSize: BlockSize, expectedItemsCount: TestObjectCount);
|
||||
_ = list.EnsureCapacity(TestObjectCount);
|
||||
}
|
||||
|
||||
[Benchmark(Baseline = true)]
|
||||
public void RecyclableList_EnsureCapacityV2_ByPowOf2()
|
||||
{
|
||||
using var list = new RecyclableListV2<object>(minBlockSize: BlockSize, expectedItemsCount: TestObjectCount);
|
||||
_ = RecyclableListV2<object>.EnsureCapacity(list, TestObjectCount);
|
||||
using var list = new RecyclableListV2<long>(minBlockSize: BlockSize, expectedItemsCount: TestObjectCount);
|
||||
_ = RecyclableListV2<long>.EnsureCapacity(list, TestObjectCount);
|
||||
}
|
||||
|
||||
[Benchmark(Baseline = false)]
|
||||
public void RecyclableList_EnsureCapacity_ByPowOf2()
|
||||
{
|
||||
using var list = new RecyclableList<object>(minBlockSize: BlockSize, expectedItemsCount: TestObjectCount);
|
||||
_ = RecyclableList<object>.EnsureCapacity(list, TestObjectCount);
|
||||
using var list = new RecyclableList<long>(minBlockSize: BlockSize, expectedItemsCount: TestObjectCount);
|
||||
_ = RecyclableList<long>.EnsureCapacity(list, TestObjectCount);
|
||||
}
|
||||
|
||||
[Benchmark(Baseline = false)]
|
||||
public void RecyclableList_EnsureCapacityV1_ByBlockSize()
|
||||
{
|
||||
using var list = new RecyclableListV1<object>();
|
||||
using var list = new RecyclableListV1<long>();
|
||||
_ = list.EnsureCapacity(TestObjectCount);
|
||||
}
|
||||
|
||||
[Benchmark(Baseline = false)]
|
||||
public void RecyclableList_EnsureCapacityV2_ByBlockSize()
|
||||
{
|
||||
using var list = new RecyclableListV2<object>();
|
||||
_ = RecyclableListV2<object>.EnsureCapacity(list, TestObjectCount);
|
||||
using var list = new RecyclableListV2<long>();
|
||||
_ = RecyclableListV2<long>.EnsureCapacity(list, TestObjectCount);
|
||||
}
|
||||
|
||||
[Benchmark(Baseline = false)]
|
||||
public void RecyclableList_EnsureCapacity_ByBlockSize()
|
||||
{
|
||||
using var list = new RecyclableList<object>();
|
||||
_ = RecyclableList<object>.EnsureCapacity(list, TestObjectCount);
|
||||
using var list = new RecyclableList<long>();
|
||||
_ = RecyclableList<long>.EnsureCapacity(list, TestObjectCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user