runSuite function

Future<void> runSuite(
  1. List<String> args,
  2. FutureOr<void> body()
)

Declares benchmarks in body and runs them with options from args, the command line given to main: --quick, --verify, --filter and the others listed in runMainUsage.

Future<void> main(List<String> args) => runSuite(args, () {
  group('join', () {
    benchmark('join', () => words.join());
    benchmark('StringBuffer', () => (StringBuffer()..writeAll(words)).toString());
  });
});

A plain void main() runs declared benchmarks as well, taking options from the MICROBENCH_ARGS environment variable, which dart run microbench <file> -- <options> sets. Use runSuite so that dart run <file> <options> works too. This is runMain under a name that reads well with benchmark.

Implementation

Future<void> runSuite(List<String> args, FutureOr<void> Function() body) =>
    runMain(args, body);