Benchmarking
dotnet add package BenchmarkDotNet
Program.cs
using BenchmarkDotNet.Running;
public static void Main() {
BenchmarkRunner.Run<SomeBenchmarks>();
}
SomeBenchmarks.cs
using BenchmarkDotNet.Attributes; // [Benchmark]
public class SomeBenchmarks {
…
public SomeBenchmarks() {
…
[Benchmark(Baseline = true)]
public string SomeTest() {
…
}
[Benchmark]
public string SomeOtherTest() {
…
}
}
}
Then:dotnet run --configuration release