Initial version extracted from Recyclable.Collections

This commit is contained in:
mlemanczyk committed 2023-10-21 14:07:23 +02:00
1 parent 01bbd5d04f
commit 4684330d7e
22 files changed
+2403 -1

No files matched your search

@@ -0,0 +1,50 @@
using Collections.Benchmarks.Core;
namespace Recyclable.Collections.Benchmarks
{
public class ConvertAllBenchmarks<T> : CollectionsBenchmarksBase<T>
{
public void Array_ConvertAll()
{
var data = TestObjects;
var list = TestObjects;
var dataCount = TestObjectCountForSlowMethods;
DoNothing.With(Array.ConvertAll(list, static (item) => (long)item));
}
public void List_ConvertAll()
{
var data = TestObjects;
var list = TestObjectsAsList;
var dataCount = TestObjectCountForSlowMethods;
DoNothing.With(list.ConvertAll(static (item) => (long)item));
}
public void PooledList_ConvertAll()
{
var data = TestObjects;
var list = TestObjectsAsPooledList;
var dataCount = TestObjectCountForSlowMethods;
using var converted = list.ConvertAll(static (item) => (long)item);
DoNothing.With(converted);
}
public void RecyclableList_ConvertAll()
{
var data = TestObjects;
var list = TestObjectsAsRecyclableList;
var dataCount = TestObjectCountForSlowMethods;
using RecyclableList<long> converted = list.ConvertAll(static (item) => (long)item);
DoNothing.With(converted);
}
// public void RecyclableLongList_ConvertAll()
// {
// var data = TestObjects;
// var list = TestObjectsAsRecyclableLongList;
// var dataCount = TestObjectCountForSlowMethods;
// using RecyclableList<long> converted = list.ConvertAll(static (item) => (long)item);
// DoNothing(converted);
// }
}
}