April 2018
Intermediate to advanced
300 pages
7h 41m
English
Benchmark configuration can be defined by creating a custom class and inheriting it from the ManualConfig class. Here is an example of the TestBenchmark class that we created earlier containing some benchmark methods:
[Config(typeof(Config))]
public class TestBenchmark
{
private class Config : ManualConfig
{
// We will benchmark ONLY method with names with names (which // contains "A" OR "1") AND (have length < 3) public Config() { Add(new DisjunctionFilter( new NameFilter(name => name.Contains("Recursive")) )); } } [Params(10,20,30)] public int Len { get; set; } [Benchmark] public void Fibonacci() { int a = 0, b = 1, c = 0; Console.Write("{0} {1}", a, b); for (int i = 2; i < Len; i++) { c = a + b; Console.Write(" {0}", ...