Closed
Description
I want to write a benchmark where I want to compare two approaches. Both have two input parameters but the second one is of a slightly different type for each method. So I have essentially an A and a B and a B' parameter
If I put both benchmark methods into the same benchmark class, I get the Cartesian product of all parameter combinations A x B x B' for each benchmark. (in the example below 2 * 3 * 3 * 3 ) But I really want A x B and A x B' (in the example below 2 * 3 * 3)
I can write two different benchmark classes and copy the first parameter set A or share it somehow through C#. But then I get two output tables.
To Illustrate (truly just illustration, these are obviously not the real benchmarks.)
public class DemoBenchmark
{
[Params("A", "B", "C")]
public string name;
[Params(1, 2, 3)]
public int count;
[Params(5, 6, 7)]
public long longCount;
[Benchmark]
public bool EvalMethod1() => name.Length == count;
[Benchmark(Baseline = true)]
public bool EvalMethod2() => name.Length == longCount;
}
Is there a way to either
- annotate the Benchmark method to ignore one parameter and don't iterate over that parameter?
- or alternatively combine the results of two benchmark classes into one output table ?