Benchmark results and TODOs added / updated

This commit is contained in:
Marek Lemańczyk committed 2025-10-02 15:00:30 +02:00
1 parent 507b9c91f4
commit f9e548279c
31 files changed
+581 -364

No files matched your search

@@ -11,16 +11,22 @@ public class Mod6UInt128Benchmarks
[Params(6UL, 8191UL, 131071UL, 2147483647UL, ulong.MaxValue - 63UL)]
public UInt128 Value { get; set; }
/// <summary>
/// `% 6` baseline; recorded 2.89-2.91 ns on the smaller values and 2.874 ns at 2147483647, 2.908 ns near ulong.Max.
/// </summary>
[Benchmark(Baseline = true)]
public ulong ModuloOperator()
{
return (ulong)(Value % 6UL);
}
/// <summary>
/// Extension helper (<see cref="UInt128Extensions.Mod6"/>); reduced the timings to 1.16-1.24 ns (1.180 ns at value 6, 1.164 ns at
/// 8191, 1.158 ns at 131071, 1.241 ns at 2147483647, 1.167 ns near ulong.Max), roughly 2.4-2.5x faster.
/// </summary>
[Benchmark]
public ulong ExtensionMethod()
{
return Value.Mod6();
}
}