BenchmarkDotNet=v0.13.1, OS=ubuntu 20.04
Intel Xeon Platinum 8171M CPU 2.60GHz, 1 CPU, 2 logical and 2 physical cores
.NET SDK=6.0.100-rc.2.21420.30
[Host] : .NET 5.0.9 (5.0.921.35908), X64 RyuJIT
.NET 5.0 : .NET 5.0.9 (5.0.921.35908), X64 RyuJIT
.NET 6.0 : .NET 6.0.0 (6.0.21.42010), X64 RyuJIT
.NET 6.0 PGO + EA : .NET 6.0.0 (6.0.21.42010), X64 RyuJIT, EnvVars(DOTNET_JitObjectStackAllocation=1,DOTNET_TieredPgo=1,DOTNET_ReadyToRun=0,DOTNET_TC_QuickJitForLoops=1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PdqSort: https://github.com/orlp/pdqsort | |
using System.Numerics; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Configs; | |
using BenchmarkDotNet.Environments; | |
using BenchmarkDotNet.Jobs; | |
using BenchmarkDotNet.Running; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = Nat.FromNumber(5); | |
a++; a++; a++; a++; | |
var b = Nat.FromNumber(20); | |
var c = a + b; | |
var d = Nat.FromNumber(2); | |
var e = b * c; | |
e--; | |
var f = c / d; | |
Console.WriteLine((e + f).ToNumber<int>()); // 593 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using IColors = System.Collections.Generic.IDictionary<string, string>; | |
using HTMLElement = System.Object; | |
using Element = System.Object; | |
using KeyboardEvent = System.Object; | |
using MouseEvent = System.Object; | |
using CharacterPair = System.ValueTuple<string, string>; | |
using Definition = Monaco.Languages.LocationLink; | |
using IMonarchLanguageRule = Monaco.Languages.IExpandedMonarchLanguageRule; | |
using BroswerWorker = System.Object; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace NatEmulation | |
{ | |
public abstract record Nat() | |
{ | |
public static Nat operator +(Nat left, Nat right) => | |
left switch | |
{ | |
Zero => right, |