Test data item type changed to "long" for performance reasons.

This commit is contained in:
mlemanczyk committed 2023-04-30 21:01:28 +02:00
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;