| Index: packages/code_transformers/lib/src/async_benchmark_base.dart
|
| diff --git a/packages/code_transformers/lib/src/async_benchmark_base.dart b/packages/code_transformers/lib/src/async_benchmark_base.dart
|
| index 0d9966f5d50e7d63bb8cd524756689318212eadd..423ff642925b1de56068bb41decc0672d549f094 100644
|
| --- a/packages/code_transformers/lib/src/async_benchmark_base.dart
|
| +++ b/packages/code_transformers/lib/src/async_benchmark_base.dart
|
| @@ -54,18 +54,16 @@ class AsyncBenchmarkBase {
|
| }
|
|
|
| // Measures the average time to call `run` once and returns it.
|
| - Future<double> measure({int iterations: 10}) {
|
| + Future<double> measure({int iterations: 10}) async {
|
| // Unmeasured setup code.
|
| - return setup().then((_) {
|
| - // Warmup for at least 100ms. Discard result.
|
| - return measureFor(() => warmup(), 100);
|
| - }).then((_) {
|
| - // Run the benchmark for at least 2000ms.
|
| - return measureFor(() => exercise(iterations: iterations), 2000);
|
| - }).then((result) {
|
| - // Tear down the test (unmeasured) and return the result divided by the
|
| - // number of iterations.
|
| - return teardown().then((_) => result / iterations);
|
| - });
|
| + await setup();
|
| + // Warmup for at least 100ms. Discard result.
|
| + await measureFor(() => warmup(), 100);
|
| + // Run the benchmark for at least 2000ms.
|
| + var result = await measureFor(() => exercise(iterations: iterations), 2000);
|
| + // Tear down the test (unmeasured) and return the result divided by the
|
| + // number of iterations.
|
| + await teardown();
|
| + return result / iterations;
|
| }
|
| }
|
|
|