(r: Benchmark.Report) -> [TimeInterval] in let ex1 = r.time(label: "for: ") { for i in 1...n { String(i) } } let ex2 = r.time(label: "forEach: ") { (1...n).forEach({ String($0) }) } let total = ex1.elapsed + ex2.elapsed let ave = total / 2 return [total, ave] } // for: 0.027s // forEach: 0.037s // total: 0.064s // ave: 0.032s