Benchmarks added & reorganized.

This commit is contained in:
mlemanczyk committed 2023-12-28 19:47:02 +01:00
1 parent ccf5c61dd0
commit a216c028a0
48 files changed
+13483 -363

No files matched your search

@@ -0,0 +1,50 @@
// Ignore Spelling: Poc
using BenchmarkDotNet.Attributes;
using Collections.Benchmarks.Core;
#pragma warning disable CA1822 // Mark members as static
namespace Recyclable.Collections.Benchmarks.POC
{
public class GreaterOperatorVsNotEqualOperatorBenchmarks
{
private static readonly long _num = RecyclableDefaults.MinItemsCountForParallelization;
[GlobalSetup]
public void Setup()
{
Console.WriteLine($"*** We're comparing if {_num} is < 0 ***");
}
[Benchmark(Baseline = true)]
public void CompareWithGreater()
{
DoNothing.With(_num > 0 ? 1 : 0);
}
[Benchmark]
public void CompareWithGreaterEqual()
{
DoNothing.With(_num >= 0 ? 1 : 0);
}
[Benchmark]
public void CompareWithNotEqual()
{
DoNothing.With(_num != 0 ? 1 : 0);
}
[Benchmark]
public void CompareWithLess()
{
DoNothing.With(_num < 0 ? 1 : 0);
}
[Benchmark]
public void CompareWithEqual()
{
DoNothing.With(_num == 0 ? 0 : 1);
}
}
}