public void ScoreDrawMethods() { foreach (var drawer in drawers) { var total = TimeSpan.Zero; foreach (var polygon in ListUtil.Repeat(() => testPolygons, 10).SelectMany(x => x)) { var first = DateTime.Now; drawer.Draw(polygon).ToList(); var then = DateTime.Now; total += then - first; } Console.WriteLine("drawer " + drawer + " took " + total.TotalMilliseconds + " ms."); } }
public static IEnumerable <T> ApplySlow <T>(Random random, IList <T> xs) { return(ListUtil.Repeat(() => (int)(xs.Count * Sample(random))).Distinct().Take(xs.Count).Select(index => xs[index])); }