[MemoryDiagnoser]
public class SheepBenchmarks
{
private const string inputDreamLong = "Dog,Sheep,cat,lion,sheep,tiger,Dog,Sheep,cat,lion,sheep,tiger," +
"Dog,Sheep,cat,lion,sheep,tiger,Dog,Sheep,cat,lion,sheep,tiger" +
"Dog,Sheep,cat,lion,sheep,tiger,Dog,Sheep,cat,lion,sheep,tiger" +
"Dog,Sheep,cat,lion,sheep,tiger,Dog,Sheep,cat,lion,sheep,tiger" +
"Dog,Sheep,cat,lion,sheep,tiger,Dog,Sheep,cat,lion,sheep,tiger" +
"Dog,Sheep,cat,lion,sheep,tiger,Dog,Sheep,cat,lion,sheep,tiger" +
"Dog,Sheep,cat,lion,sheep,tiger,sheep,Sheep,cat,lion,sheep,tiger";
private const string inputDreamNone = "Dog";
private SheepCount sheepCount = new SheepCount();
[ParamsSource(nameof(ValuesForDream))]
public string Dream { get; set; }
public IEnumerable<string> ValuesForDream => new[] { inputDreamLong , inputDreamNone };
[Benchmark]
public void StringSheep()
{
var count = sheepCount.TotalSheepStr(Dream);
}
[Benchmark]
public void RegexSheep()
{
var count = sheepCount.TotalSheepRegex(Dream);
}
}