OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library observe.test.benchmark.index; | 4 library observe.test.benchmark.index; |
5 | 5 |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 import 'package:benchmark_harness/benchmark_harness.dart'; | 8 import 'package:benchmark_harness/benchmark_harness.dart'; |
9 import 'package:chart/chart.dart'; | 9 import 'package:chart/chart.dart'; |
10 import 'package:observe/mirrors_used.dart' as mu; // Makes output smaller. | 10 import 'package:observe/mirrors_used.dart' as mu; // Makes output smaller. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 final ButtonElement goButton = querySelector('#go'); | 49 final ButtonElement goButton = querySelector('#go'); |
50 final InputElement objectCountInput = querySelector('#objectCountInput'); | 50 final InputElement objectCountInput = querySelector('#objectCountInput'); |
51 final InputElement mutationCountInput = querySelector('#mutationCountInput'); | 51 final InputElement mutationCountInput = querySelector('#mutationCountInput'); |
52 final SpanElement mutationCountWrapper = querySelector('#mutationCountWrapper'); | 52 final SpanElement mutationCountWrapper = querySelector('#mutationCountWrapper'); |
53 final SpanElement statusSpan = querySelector('#status'); | 53 final SpanElement statusSpan = querySelector('#status'); |
54 final DivElement canvasWrapper = querySelector('#canvasWrapper'); | 54 final DivElement canvasWrapper = querySelector('#canvasWrapper'); |
55 final SelectElement benchmarkSelect = querySelector('#benchmarkSelect'); | 55 final SelectElement benchmarkSelect = querySelector('#benchmarkSelect'); |
56 final SelectElement configSelect = querySelector('#configSelect'); | 56 final SelectElement configSelect = querySelector('#configSelect'); |
57 final UListElement legendList = querySelector('#legendList'); | 57 final UListElement legendList = querySelector('#legendList'); |
58 final List<List<String>> colors = [ | 58 final List<String> colors = [ |
59 [0, 0, 255], | 59 [0, 0, 255], |
60 [138, 43, 226], | 60 [138, 43, 226], |
61 [165, 42, 42], | 61 [165, 42, 42], |
62 [100, 149, 237], | 62 [100, 149, 237], |
63 [220, 20, 60], | 63 [220, 20, 60], |
64 [184, 134, 11] | 64 [184, 134, 11] |
65 ].map((rgb) => 'rgba(' + rgb.join(',') + ',.7)').toList(); | 65 ].map((rgb) => 'rgba(' + rgb.join(',') + ',.7)').toList(); |
66 | 66 |
67 main() { | 67 main() { |
68 // TODO(jakemac): Use a transformer to generate the smoke config so we can see | 68 // TODO(jakemac): Use a transformer to generate the smoke config so we can see |
(...skipping 20 matching lines...) Expand all Loading... |
89 | 89 |
90 var i = 0; | 90 var i = 0; |
91 mutationCounts.forEach((count) { | 91 mutationCounts.forEach((count) { |
92 var li = document.createElement('li'); | 92 var li = document.createElement('li'); |
93 li.text = '$count mutations.'; | 93 li.text = '$count mutations.'; |
94 li.style.color = colors[i % colors.length]; | 94 li.style.color = colors[i % colors.length]; |
95 legendList.append(li); | 95 legendList.append(li); |
96 i++; | 96 i++; |
97 }); | 97 }); |
98 | 98 |
99 var results = []; | 99 var results = <List<double>>[]; |
100 for (int objectCount in objectCounts) { | 100 for (int objectCount in objectCounts) { |
101 int x = 0; | 101 int x = 0; |
102 for (int mutationCount in mutationCounts) { | 102 for (int mutationCount in mutationCounts) { |
103 statusSpan.text = | 103 statusSpan.text = |
104 'Testing: $objectCount objects with $mutationCount mutations'; | 104 'Testing: $objectCount objects with $mutationCount mutations'; |
105 // Let the status text render before running the next benchmark. | 105 // Let the status text render before running the next benchmark. |
106 await new Future(() {}); | 106 await new Future(() {}); |
107 var factory = benchmarkFactories[benchmarkSelect.value]; | 107 var factory = benchmarkFactories[benchmarkSelect.value]; |
108 var benchmark = factory(objectCount, mutationCount, configSelect.value); | 108 var benchmark = factory(objectCount, mutationCount, configSelect.value); |
109 // Divide by 10 because benchmark_harness returns the amount of time it | 109 // Divide by 10 because benchmark_harness returns the amount of time it |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 configSelect.style.display = 'inline'; | 160 configSelect.style.display = 'inline'; |
161 } | 161 } |
162 | 162 |
163 // Don't show the mutation counts box if running a Setup* benchmark. | 163 // Don't show the mutation counts box if running a Setup* benchmark. |
164 if (benchmarkSelect.value.startsWith('Setup')) { | 164 if (benchmarkSelect.value.startsWith('Setup')) { |
165 mutationCountWrapper.style.display = 'none'; | 165 mutationCountWrapper.style.display = 'none'; |
166 } else { | 166 } else { |
167 mutationCountWrapper.style.display = 'inline'; | 167 mutationCountWrapper.style.display = 'inline'; |
168 } | 168 } |
169 } | 169 } |
OLD | NEW |