using System.Threading;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Mathematics;
using BenchmarkDotNet.Order;
namespace BenchmarkDotNet.Samples
{
[ShortRunJob]
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
[RankColumn(NumeralSystem.Arabic)]
[RankColumn(NumeralSystem.Roman)]
[RankColumn(NumeralSystem.Stars)]
public class IntroRankColumn
{
[Params(1, 2)]
public int Factor;
[Benchmark]
public void Foo() => Thread.Sleep(Factor * 100);
[Benchmark]
public void Bar() => Thread.Sleep(Factor * 200);
}
}
Output
Method | Factor | Mean | Error | StdDev | Rank | Rank | Rank |
------- |------- |---------:|---------:|----------:|-----:|-----:|-----:|
Foo | 1 | 100.8 ms | 2.250 ms | 0.1272 ms | 1 | I | * |
Foo | 2 | 200.8 ms | 4.674 ms | 0.2641 ms | 2 | II | ** |
Bar | 1 | 200.9 ms | 2.012 ms | 0.1137 ms | 2 | II | ** |
Bar | 2 | 400.7 ms | 4.509 ms | 0.2548 ms | 3 | III | *** |