OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:isolate'; | 5 import 'dart:isolate'; |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 | 7 |
8 class Expect { | 8 class Expect { |
9 static void equals(x, y) { | 9 static void equals(x, y) { |
10 if (x != y) throw new ArgumentError('not equal'); | 10 if (x != y) throw new ArgumentError('not equal'); |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 | 714 |
715 // The benchmark code. | 715 // The benchmark code. |
716 // This function is not used, if both [warmup] and [exercise] are overwritten. | 716 // This function is not used, if both [warmup] and [exercise] are overwritten. |
717 void run() {} | 717 void run() {} |
718 | 718 |
719 // Runs a short version of the benchmark. By default invokes [run] once. | 719 // Runs a short version of the benchmark. By default invokes [run] once. |
720 void warmup() { | 720 void warmup() { |
721 run(); | 721 run(); |
722 } | 722 } |
723 | 723 |
724 // Exercices the benchmark. By default invokes [run] 10 times. | 724 // Exercises the benchmark. By default invokes [run] 10 times. |
725 void exercise() { | 725 void exercise() { |
726 for (int i = 0; i < 10; i++) { | 726 for (int i = 0; i < 10; i++) { |
727 run(); | 727 run(); |
728 } | 728 } |
729 } | 729 } |
730 | 730 |
731 // Not measured setup code executed prior to the benchmark runs. | 731 // Not measured setup code executed prior to the benchmark runs. |
732 void setup() {} | 732 void setup() {} |
733 | 733 |
734 // Not measures teardown code executed after the benchmark runs. | 734 // Not measures teardown code executed after the benchmark runs. |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 void processLines() { | 1542 void processLines() { |
1543 port.receive((message, SendPort replyTo) { | 1543 port.receive((message, SendPort replyTo) { |
1544 if (message == TERMINATION_MESSAGE) { | 1544 if (message == TERMINATION_MESSAGE) { |
1545 assert(replyTo == null); | 1545 assert(replyTo == null); |
1546 port.close(); | 1546 port.close(); |
1547 } else { | 1547 } else { |
1548 replyTo.send(processLine(message), null); | 1548 replyTo.send(processLine(message), null); |
1549 } | 1549 } |
1550 }); | 1550 }); |
1551 } | 1551 } |
OLD | NEW |