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

Unified Diff: packages/code_transformers/lib/src/async_benchmark_base.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 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
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;
}
}
« no previous file with comments | « packages/code_transformers/lib/messages/messages.dart ('k') | packages/code_transformers/lib/src/dart_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698