OLD | NEW |
1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 import 'package:kernel/kernel.dart'; | 5 import 'package:kernel/kernel.dart'; |
6 import 'package:kernel/class_hierarchy.dart'; | 6 import 'package:kernel/class_hierarchy.dart'; |
7 import 'package:args/args.dart'; | 7 import 'package:args/args.dart'; |
8 import 'class_hierarchy_basic.dart'; | 8 import 'class_hierarchy_basic.dart'; |
9 import 'dart:math'; | 9 import 'dart:math'; |
10 import 'dart:io'; | 10 import 'dart:io'; |
11 | 11 |
12 ArgParser argParser = new ArgParser() | 12 ArgParser argParser = new ArgParser() |
13 ..addFlag('basic', help: 'Measure the basic implementation', negatable: false) | 13 ..addFlag('basic', help: 'Measure the basic implementation', negatable: false) |
14 ..addOption('cycle', | 14 ..addOption('cycle', |
15 abbr: 'c', | 15 abbr: 'c', |
16 help: 'Build N copies of the class hierarchy and cycle queries ' | 16 help: 'Build N copies of the class hierarchy and cycle queries ' |
17 'between them', | 17 'between them', |
18 defaultsTo: '1'); | 18 defaultsTo: '1'); |
19 | 19 |
20 String usage = ''' | 20 String usage = ''' |
21 Usage: class_hierarchy_bench [options] FILE.dart | 21 Usage: class_hierarchy_bench [options] FILE.dill |
22 | 22 |
23 Options: | 23 Options: |
24 ${argParser.usage} | 24 ${argParser.usage} |
25 '''; | 25 '''; |
26 | 26 |
27 main(List<String> args) { | 27 main(List<String> args) { |
28 if (args.length == 0) { | 28 if (args.length == 0) { |
29 print(usage); | 29 print(usage); |
30 exit(1); | 30 exit(1); |
31 } | 31 } |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 : list[mid].toDouble(); | 336 : list[mid].toDouble(); |
337 } | 337 } |
338 | 338 |
339 num sum(Iterable<num> values) { | 339 num sum(Iterable<num> values) { |
340 num result = 0; | 340 num result = 0; |
341 for (var x in values) { | 341 for (var x in values) { |
342 result += x; | 342 result += x; |
343 } | 343 } |
344 return result; | 344 return result; |
345 } | 345 } |
OLD | NEW |