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

Side by Side Diff: pkg/kernel/test/class_hierarchy_membench.dart

Issue 2904203002: Extract ClassHierarchyImpl implementation from ClassHierarchy. (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
OLDNEW
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:io'; 9 import 'dart:io';
10 10
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 String filename = options.rest.single; 37 String filename = options.rest.single;
38 38
39 Program program = loadProgramFromBinary(filename); 39 Program program = loadProgramFromBinary(filename);
40 40
41 int copyCount = int.parse(options['count']); 41 int copyCount = int.parse(options['count']);
42 42
43 ClassHierarchy buildHierarchy() { 43 ClassHierarchy buildHierarchy() {
44 return options['basic'] 44 return options['basic']
45 ? new BasicClassHierarchy(program) 45 ? new BasicClassHierarchy(program)
46 : new ClassHierarchy(program); 46 : new ClassHierarchyImpl(program);
47 } 47 }
48 48
49 List<ClassHierarchy> keepAlive = <ClassHierarchy>[]; 49 List<ClassHierarchyImpl> keepAlive = <ClassHierarchyImpl>[];
50 for (int i = 0; i < copyCount; ++i) { 50 for (int i = 0; i < copyCount; ++i) {
51 keepAlive.add(buildHierarchy()); 51 keepAlive.add(buildHierarchy());
52 } 52 }
53 53
54 print('$copyCount copies built'); 54 print('$copyCount copies built');
55 55
56 if (args.contains('-v')) { 56 if (args.contains('-v')) {
57 // Use of the list for something to avoid premature GC. 57 // Use of the list for something to avoid premature GC.
58 int size = 0; 58 int size = 0;
59 for (var classHierarchy in keepAlive) { 59 for (var classHierarchy in keepAlive) {
60 size += classHierarchy.getSuperTypeHashTableSize(); 60 size += classHierarchy.getSuperTypeHashTableSize();
61 } 61 }
62 print(size); 62 print(size);
63 } 63 }
64 } 64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698