Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1425)

Unified Diff: lib/src/async_benchmark_base.dart

Issue 1830403002: switch package to strong mode (Closed) Base URL: git@github.com:dart-lang/code_transformers.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/messages/messages.dart ('k') | lib/src/dart_sdk.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/async_benchmark_base.dart
diff --git a/lib/src/async_benchmark_base.dart b/lib/src/async_benchmark_base.dart
index 0d9966f5d50e7d63bb8cd524756689318212eadd..423ff642925b1de56068bb41decc0672d549f094 100644
--- a/lib/src/async_benchmark_base.dart
+++ b/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;
}
}
« no previous file with comments | « lib/messages/messages.dart ('k') | lib/src/dart_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698