Extension methods benchmarked. Slower alternatives replaced.

This commit is contained in:
Marek Lemańczyk committed 2025-09-23 22:01:09 +02:00
1 parent 9becb8df67
commit 6e99ee39e3
40 files changed
+930 -1026

No files matched your search

@@ -1,4 +1,3 @@
using System.Numerics;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using PerfectNumbers.Core;
@@ -12,12 +11,16 @@ public class Mod128UInt128Benchmarks
[Params(128UL, 8191UL, 131071UL, 2147483647UL, ulong.MaxValue - 511UL)]
public UInt128 Value { get; set; }
[Benchmark(Baseline = true)]
[Benchmark(Baseline = true)]
public ulong ModuloOperator()
{
return (ulong)(Value % 128UL);
}
/// <summary>
/// Fastest
/// </summary>
/// <returns></returns>
[Benchmark]
public ulong ExtensionMethod()
{