1

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?

Ssss
  • 155
  • 1
  • 12
  • 4
    The answer is yes, in fact there is a setting that does just that, have you looked at the documentation? Its on the front page of the wiki – TheGeneral Jun 15 '20 at 09:50
  • @TheGeneral you are right. I found it and added answer to my own question below. – Ssss Jun 15 '20 at 12:14

1 Answers1

4

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()
    {
    }
}
Ssss
  • 155
  • 1
  • 12