Search code examples
c#benchmarkingbenchmarkdotnet

BenchmarkDotNet. Is it possible to include not warmed up results?


Assume we have some big method which is very slow on a cold start. Can we do such benchmarks and see not warmed up results?


Solution

  • As was noted - it is possible and there is some info in official docs.

    [MinColumn, MaxColumn]
    [MemoryDiagnoser]
    [SimpleJob(RunStrategy.ColdStart, launchCount: 3,
        warmupCount: 0, targetCount: 6)]
    public class SomeBenchmark
    {
        [Benchmark]
        public string Benchmark()
        {
        }
    }