| 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'; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 buildHierarchy(); | 48 buildHierarchy(); |
| 49 int coldBuildTime = watch.elapsedMilliseconds; | 49 int coldBuildTime = watch.elapsedMilliseconds; |
| 50 watch.reset(); | 50 watch.reset(); |
| 51 const int numBuildTrials = 100; | 51 const int numBuildTrials = 100; |
| 52 for (int i = 0; i < numBuildTrials; i++) { | 52 for (int i = 0; i < numBuildTrials; i++) { |
| 53 buildHierarchy(); | 53 buildHierarchy(); |
| 54 } | 54 } |
| 55 int hotBuildTime = watch.elapsedMilliseconds ~/ numBuildTrials; | 55 int hotBuildTime = watch.elapsedMilliseconds ~/ numBuildTrials; |
| 56 | 56 |
| 57 int hierarchyCount = int.parse(options['cycle']); | 57 int hierarchyCount = int.parse(options['cycle']); |
| 58 var hierarchies = <ClassHierarchy>[]; | 58 var hierarchies = <ClosedWorldClassHierarchy>[]; |
| 59 for (int i = 0; i < hierarchyCount; i++) { | 59 for (int i = 0; i < hierarchyCount; i++) { |
| 60 hierarchies.add(buildHierarchy()); | 60 hierarchies.add(buildHierarchy()); |
| 61 } | 61 } |
| 62 | 62 |
| 63 int currentHierarchy = 0; | 63 int currentHierarchy = 0; |
| 64 ClassHierarchy getClassHierarchy() { | 64 ClosedWorldClassHierarchy getClassHierarchy() { |
| 65 currentHierarchy = (currentHierarchy + 1) % hierarchies.length; | 65 currentHierarchy = (currentHierarchy + 1) % hierarchies.length; |
| 66 return hierarchies[currentHierarchy]; | 66 return hierarchies[currentHierarchy]; |
| 67 } | 67 } |
| 68 | 68 |
| 69 Random rnd = new Random(12345); | 69 Random rnd = new Random(12345); |
| 70 const int numQueryTrials = 100000; | 70 const int numQueryTrials = 100000; |
| 71 | 71 |
| 72 // Measure isSubclassOf, isSubmixtureOf, isSubtypeOf, getClassAsInstanceOf. | 72 // Measure isSubclassOf, isSubmixtureOf, isSubtypeOf, getClassAsInstanceOf. |
| 73 | 73 |
| 74 // Warm-up run to ensure the JIT compiler does not favor the first query we | 74 // Warm-up run to ensure the JIT compiler does not favor the first query we |
| (...skipping 261 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 |