Additional benchmarks added. One-off quick smoke test added.

This commit is contained in:
mlemanczyk committed 2023-04-11 00:16:05 +02:00
1 parent 91515cb76b
commit 24a14f810b
1 file changed
+35 -13
+35 -13
View File
@@ -29,20 +29,25 @@ internal class Program
{
var benchmark = new RecyclableCollectionsBenchmarks();
benchmark.Setup();
foreach (var _ in Enumerable.Range(1, 1000))
{
//benchmark.RecyclableList_Contains();
//benchmark.RecyclableArrayList_AddRange_WithCapacity();
//benchmark.RecyclableArrayList_Add_WithCapacity();
//foreach (var _ in Enumerable.Range(1, 1000))
//{
//benchmark.RecyclableList_Contains();
//benchmark.RecyclableArrayList_AddRange_WithCapacity();
//benchmark.RecyclableArrayList_Add_WithCapacity();
//benchmark.RecyclableList_Create();
//benchmark.RecyclableList_Create_WithCapacity();
//benchmark.RecyclableList_Add();
//benchmark.RecyclableList_Add_WithCapacity();
//benchmark.RecyclableList_Contains_LastItems();
//benchmark.RecyclableList_IndexOf_FirstItems();
benchmark.RecyclableList_AddRangeWhenSourceIsList();
}
//benchmark.RecyclableList_Create();
//benchmark.RecyclableList_Create_WithCapacity();
//benchmark.RecyclableList_Add();
//benchmark.RecyclableList_Add_WithCapacity();
//benchmark.RecyclableList_Contains_LastItems();
//benchmark.RecyclableList_IndexOf_FirstItems();
//benchmark.RecyclableList_AddRangeWhenSourceIsList();
//benchmark.RecyclableList_Remove_FirstItems();
//benchmark.RecyclableList_RemoveAt_LastItems();
//benchmark.RecyclableList_EnsureCapacity_New_ByBlockSize();
benchmark.RecyclableList_EnsureCapacity_ByPowOf2();
//benchmark.List_RemoveAt_LastItems();
//}
benchmark.Cleanup();
}
@@ -53,6 +58,23 @@ internal class Program
ManualConfig.Create(DefaultConfig.Instance).WithOptions(ConfigOptions.DisableOptimizationsValidator | ConfigOptions.JoinSummary)
);
//var pool = ArrayPool<object>.Shared;
//for (long bufferSize = int.MaxValue / 2; bufferSize <= int.MaxValue; bufferSize += 100_000_000)
//{
// try
// {
// Console.WriteLine($"Allocating {bufferSize}");
// var arr = pool.Rent((int)bufferSize);
// pool.Return(arr);
// GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true, true);
// }
// catch (Exception)
// {
// Console.WriteLine($"Error during array creation. {nameof(bufferSize)} = {bufferSize}");
// throw;
// }
//}
//RunBenchmark();