static IEnumerable <Func <(long, SubstitutorType)> > PrepareBenchmarkData(int sizeMultiplier, LinearSubstitutor ls, RegexSubstitutor rs) { var template = string.Join(string.Empty, Enumerable.Repeat(Template.Value, sizeMultiplier)); Func <(long, SubstitutorType)> linearFunc = new Func <(long, SubstitutorType)>(() => { var res = ExecutionHelper.GetExecutionTime(() => ls.FindAndSubstitute(Template.TemplateData, template)); return(res.ticks, ls.Type); }); Func <(long, SubstitutorType)> regexFunc = new Func <(long, SubstitutorType)>(() => { var res = ExecutionHelper.GetExecutionTime(() => rs.FindAndSubstitute(Template.TemplateData, template)); return(res.ticks, rs.Type); }); Console.WriteLine($"Template size: {sizeMultiplier} benchmark"); return(Enumerable.Repeat(regexFunc, BenchmarkIterations).Concat(Enumerable.Repeat(linearFunc, BenchmarkIterations))); }