BenchmarkResults[] timings; benchmark!( "file write", { std.file.write("/tmp/deleteme", "hello, world!"); }, "file read", { std.file.read("/tmp/deleteme"); }) (timings); foreach (ref datum; timings) { writefln("%s: %s ns/iteration", datum.benchmarkName, datum.perIteration.to!("nsecs", uint)); }
Benchmarks functions and appends the results to the results parameter. This function is used by printBenchmarks, and the funs parameter has the same requirements as for that function.
Using benchmark directly is recommended for custom processing and printing of benchmark results.