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

Unified Diff: example/runner-pool.dart

Issue 955053002: adding codereview file, formatting, adding gitignore (Closed) Base URL: https://github.com/dart-lang/isolate.git@master
Patch Set: Created 5 years, 10 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: example/runner-pool.dart
diff --git a/example/runner-pool.dart b/example/runner-pool.dart
index e81e496050ee2f88fba6a04e61f8b02d6900ab82..e4d7b311d421715808fc7edd99cfd86f5d7daf83 100644
--- a/example/runner-pool.dart
+++ b/example/runner-pool.dart
@@ -8,7 +8,6 @@ import "package:isolate/loadbalancer.dart";
import "package:isolate/isolaterunner.dart";
import "dart:async" show Future, Completer;
-
void main() {
int N = 44;
var sw = new Stopwatch()..start();
@@ -30,21 +29,22 @@ void main() {
// Compute fibonnacci 1..limit
Future<List<int>> parfib(int limit, int parallelity) {
- return LoadBalancer.create(parallelity, IsolateRunner.spawn).then(
- (LoadBalancer pool) {
- List<Future> fibs = new List(limit + 1);
- // Schedule all calls with exact load value and the heaviest task
- // assigned first.
- schedule(a, b, i) {
- if (i < limit) {
- schedule(a + b, a, i + 1);
- }
- fibs[i] = pool.run(fib, i, load: a);
+ return LoadBalancer
+ .create(parallelity, IsolateRunner.spawn)
+ .then((LoadBalancer pool) {
+ List<Future> fibs = new List(limit + 1);
Lasse Reichstein Nielsen 2015/02/26 10:59:13 I really dislike having the body indented less tha
+ // Schedule all calls with exact load value and the heaviest task
+ // assigned first.
+ schedule(a, b, i) {
+ if (i < limit) {
+ schedule(a + b, a, i + 1);
}
- schedule(0, 1, 0);
- // And wait for them all to complete.
- return Future.wait(fibs).whenComplete(pool.close);
- });
+ fibs[i] = pool.run(fib, i, load: a);
+ }
+ schedule(0, 1, 0);
+ // And wait for them all to complete.
+ return Future.wait(fibs).whenComplete(pool.close);
+ });
}
int computeFib(n) {

Powered by Google App Engine
This is Rietveld 408576698