RecyclableLongList.CopyFollowingItems performance improvements. Benchmarks added. Tests cleanup & normalization. Before cleanup.

This commit is contained in:
mlemanczyk committed 2023-08-03 01:50:09 +02:00
1 parent 2996553776
commit 1e5f963148
3 files changed
+119 -7

No files matched your search

@@ -0,0 +1,36 @@
using BenchmarkDotNet.Attributes;
namespace Recyclable.Collections.Benchmarks.POC
{
public enum RecyclableLongListHelpersCopyFollowingItemsBenchmarkType
{
Undefined,
Old,
New,
}
public class RecyclableLongListHelpersCopyFollowingItemsBenchmarks : RecyclableBenchmarkBase<RecyclableLongListHelpersCopyFollowingItemsBenchmarkType>
{
[Params(RecyclableLongListHelpersCopyFollowingItemsBenchmarkType.Old)]
public override RecyclableLongListHelpersCopyFollowingItemsBenchmarkType BaseDataType { get => base.BaseDataType; set => base.BaseDataType = value; }
[Params(RecyclableLongListHelpersCopyFollowingItemsBenchmarkType.New)]
public override RecyclableLongListHelpersCopyFollowingItemsBenchmarkType DataType { get => base.DataType; set => base.DataType = value; }
protected override Action GetTestMethod(RecyclableLongListHelpersCopyFollowingItemsBenchmarkType benchmarkType) => benchmarkType switch
{
RecyclableLongListHelpersCopyFollowingItemsBenchmarkType.Old => CopyFollowingItemsOld,
RecyclableLongListHelpersCopyFollowingItemsBenchmarkType.New => CopyFollowingItemsNew,
_ => throw CreateUnknownBenchmarkTypeException(benchmarkType),
};
protected override void PrepareData<RecyclableLongListHelpersCopyFollowingItemsBenchmarkType>(RecyclableLongListHelpersCopyFollowingItemsBenchmarkType benchmarkType)
{
base.PrepareData(RecyclableCollectionsBenchmarkSource.Array);
base.PrepareData(RecyclableCollectionsBenchmarkSource.RecyclableLongList);
}
public void CopyFollowingItemsOld() => RecyclableLongList<long>.Helpers.CopyFollowingItemsOld(TestObjectsAsRecyclableLongList, 0);
public void CopyFollowingItemsNew() => RecyclableLongList<long>.Helpers.CopyFollowingItems(TestObjectsAsRecyclableLongList, 0);
}
}