OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 | 4 |
5 /// An entrypoint used to run portions of fasta and measure its performance. | 5 /// An entrypoint used to run portions of fasta and measure its performance. |
6 library front_end.tool.fasta_perf; | 6 library front_end.tool.fasta_perf; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // Invoke the fasta kernel generator for the program starting in [entryUri] | 199 // Invoke the fasta kernel generator for the program starting in [entryUri] |
200 // TODO(sigmund): update to uyse the frontend api once fasta is beind hit. | 200 // TODO(sigmund): update to uyse the frontend api once fasta is beind hit. |
201 generateKernel(Uri entryUri, | 201 generateKernel(Uri entryUri, |
202 {bool compileSdk: true, bool strongMode: false}) async { | 202 {bool compileSdk: true, bool strongMode: false}) async { |
203 // TODO(sigmund): this is here only to compute the input size, | 203 // TODO(sigmund): this is here only to compute the input size, |
204 // we should extract the input size from the frontend instead. | 204 // we should extract the input size from the frontend instead. |
205 scanReachableFiles(entryUri); | 205 scanReachableFiles(entryUri); |
206 | 206 |
207 var timer = new Stopwatch()..start(); | 207 var timer = new Stopwatch()..start(); |
208 final Ticker ticker = new Ticker(); | 208 final Ticker ticker = new Ticker(); |
209 final DillTarget dillTarget = new DillTarget(ticker, uriResolver); | 209 final DillTarget dillTarget = new DillTarget(ticker, uriResolver, false); |
210 final KernelTarget kernelTarget = | 210 final KernelTarget kernelTarget = |
211 new KernelTarget(dillTarget, uriResolver, strongMode); | 211 new KernelTarget(dillTarget, uriResolver, strongMode, false); |
212 var entrypoints = [ | 212 var entrypoints = [ |
213 entryUri, | 213 entryUri, |
214 // These extra libraries are added to match the same set of libraries | 214 // These extra libraries are added to match the same set of libraries |
215 // scanned by default by the VM and the other benchmarks. | 215 // scanned by default by the VM and the other benchmarks. |
216 Uri.parse('dart:async'), | 216 Uri.parse('dart:async'), |
217 Uri.parse('dart:collection'), | 217 Uri.parse('dart:collection'), |
218 Uri.parse('dart:convert'), | 218 Uri.parse('dart:convert'), |
219 Uri.parse('dart:core'), | 219 Uri.parse('dart:core'), |
220 Uri.parse('dart:developer'), | 220 Uri.parse('dart:developer'), |
221 Uri.parse('dart:_internal'), | 221 Uri.parse('dart:_internal'), |
(...skipping 23 matching lines...) Expand all Loading... |
245 /// Report that metric [name] took [time] micro-seconds to process | 245 /// Report that metric [name] took [time] micro-seconds to process |
246 /// [inputSize] characters. | 246 /// [inputSize] characters. |
247 void report(String name, int time) { | 247 void report(String name, int time) { |
248 var sb = new StringBuffer(); | 248 var sb = new StringBuffer(); |
249 var padding = ' ' * (20 - name.length); | 249 var padding = ' ' * (20 - name.length); |
250 sb.write('$name:$padding $time us, ${time ~/ 1000} ms'); | 250 sb.write('$name:$padding $time us, ${time ~/ 1000} ms'); |
251 var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2); | 251 var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2); |
252 sb.write(', $invSpeed ns/char'); | 252 sb.write(', $invSpeed ns/char'); |
253 print('$sb'); | 253 print('$sb'); |
254 } | 254 } |
OLD | NEW |