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 library kernel.treeshaker_membench; | 5 library kernel.treeshaker_membench; |
6 | 6 |
7 import 'package:kernel/kernel.dart'; | 7 import 'package:kernel/kernel.dart'; |
8 import 'package:kernel/transformations/treeshaker.dart'; | 8 import 'package:kernel/transformations/treeshaker.dart'; |
9 import 'package:kernel/class_hierarchy.dart'; | 9 import 'package:kernel/class_hierarchy.dart'; |
10 import 'package:kernel/core_types.dart'; | 10 import 'package:kernel/core_types.dart'; |
11 import 'package:args/args.dart'; | 11 import 'package:args/args.dart'; |
12 import 'dart:io'; | 12 import 'dart:io'; |
13 | 13 |
14 ArgParser argParser = new ArgParser() | 14 ArgParser argParser = new ArgParser() |
15 ..addOption('count', abbr: 'c', | 15 ..addOption('count', |
16 help: 'Build N copies of the tree shaker', | 16 abbr: 'c', help: 'Build N copies of the tree shaker', defaultsTo: '100'); |
17 defaultsTo: '100'); | |
18 | 17 |
19 String usage = """ | 18 String usage = """ |
20 Usage: treeshaker_membench [options] FILE.dart | 19 Usage: treeshaker_membench [options] FILE.dart |
21 | 20 |
22 Options: | 21 Options: |
23 ${argParser.usage} | 22 ${argParser.usage} |
24 """; | 23 """; |
25 | 24 |
26 /// Builds N copies of the tree shaker data structure for the given program. | 25 /// Builds N copies of the tree shaker data structure for the given program. |
27 /// Pass --print-metrics to the Dart VM to measure the memory use. | 26 /// Pass --print-metrics to the Dart VM to measure the memory use. |
(...skipping 26 matching lines...) Expand all Loading... |
54 | 53 |
55 print('$copyCount copies built'); | 54 print('$copyCount copies built'); |
56 | 55 |
57 if (args.contains('-v')) { | 56 if (args.contains('-v')) { |
58 // Use of the list for something to avoid premature GC. | 57 // Use of the list for something to avoid premature GC. |
59 for (var treeShaker in keepAlive) { | 58 for (var treeShaker in keepAlive) { |
60 treeShaker.getClassRetention(hierarchy.rootClass); | 59 treeShaker.getClassRetention(hierarchy.rootClass); |
61 } | 60 } |
62 } | 61 } |
63 } | 62 } |
OLD | NEW |