public void Run(IBenchmark benchmark) { Console.WriteLine("For " + benchmark.Name + ":"); benchmark.VerifyAssertions(); benchmark.Benchmark(); // First run outside of timing to avoid any warm up side effect GC.Collect(); // Collect before run to avoid any GC effects during run Stopwatch watch = new Stopwatch(); watch.Start(); for (int i = 0; i < iterations; i++) { benchmark.Benchmark(); } watch.Stop(); Console.WriteLine("Elapsed: {0}", watch.Elapsed); Console.WriteLine("Call/ms: {0}", iterations / watch.ElapsedMilliseconds); _results.Add(new BenchmarkResult(benchmark.Name, watch.ElapsedMilliseconds)); }