Additional POC benchmarks added.
This commit is contained in:
1 parent
8ccd129bd6
commit
112a482583
4 files changed
+384
-3
No files matched your search
@@ -0,0 +1,27 @@
|
||||
using BenchmarkDotNet.Attributes;
|
||||
|
||||
namespace Recyclable.Collections.Benchmarks.POC
|
||||
{
|
||||
public class RoundBenchmarks : PocBenchmarkBase
|
||||
{
|
||||
private const double OptimalParallelSearchStep = 0.329;
|
||||
|
||||
[Benchmark(Baseline = true)]
|
||||
public void RoundWithMathFloor()
|
||||
{
|
||||
DoNothing((long)Math.Floor(TestObjectCount * OptimalParallelSearchStep));
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public void RoundWithMathRound()
|
||||
{
|
||||
DoNothing((long)Math.Round(TestObjectCount * OptimalParallelSearchStep, 0));
|
||||
}
|
||||
|
||||
[Benchmark(Baseline = false)]
|
||||
public void RoundWithTypeCasting()
|
||||
{
|
||||
DoNothing((long)(TestObjectCount * OptimalParallelSearchStep));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user