benchmark function
Run a benchmark: execute body iterations times and measure the total.
Implementation
BenchmarkResult benchmark(
String name,
void Function() body, {
int iterations = 10000,
}) {
final sw = Stopwatch()..start();
for (var i = 0; i < iterations; i++) {
body();
}
sw.stop();
return BenchmarkResult(name, iterations, sw.elapsedMicroseconds);
}