Sample: IntroParamsPriority
In order to sort columns of parameters in the results table you can use the Property Priority
inside the params attribute. The priority range is [Int32.MinValue;Int32.MaxValue]
, lower priorities will appear earlier in the column order. The default priority is set to 0
.
Source code
using System.Threading;
using BenchmarkDotNet.Attributes;
namespace BenchmarkDotNet.Samples
{
public class IntroParamsPriority
{
[Params(100)]
public int A { get; set; }
[Params(10, Priority = -100)]
public int B { get; set; }
[Benchmark]
public void Benchmark() => Thread.Sleep(A + B + 5);
}
}
Output
| Method | B | A | Mean | Error | StdDev |
|---------- |--- |---- |---------:|--------:|--------:|
| Benchmark | 10 | 100 | 115.4 ms | 0.12 ms | 0.11 ms |
Links
- Priority BaseClass
PriorityAttribute.cs
- Parameterization
- The permanent link to this sample: BenchmarkDotNet.Samples.IntroParamsPriority