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

Side by Side Diff: lib/compiler/implementation/scanner/scanner_bench.dart

Issue 10557003: Fix most warnings and other minor cleanups. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #library('scanner_bench'); 5 #library('scanner_bench');
6 #import('scannerlib.dart'); 6 #import('scannerlib.dart');
7 #import('scanner_implementation.dart'); 7 #import('scanner_implementation.dart');
8 #source('source_list.dart'); 8 #source('source_list.dart');
9 9
10 /** 10 /**
(...skipping 15 matching lines...) Expand all
26 for (int i = 0; i < iterations; i++) { 26 for (int i = 0; i < iterations; i++) {
27 bar.tick(); 27 bar.tick();
28 Stopwatch timer = new Stopwatch(); 28 Stopwatch timer = new Stopwatch();
29 timer.start(); 29 timer.start();
30 int charCount = 0; 30 int charCount = 0;
31 for (final String argument in arguments) { 31 for (final String argument in arguments) {
32 charCount += tokenizeOne(argument); 32 charCount += tokenizeOne(argument);
33 } 33 }
34 timer.stop(); 34 timer.stop();
35 bar.recordScore(charCount / timer.elapsedInMs()); 35 bar.recordScore(charCount / timer.elapsedInMs());
36 log("Tokenized ${arguments.length} files " + 36 log("Tokenized ${arguments.length} files "
37 "(total size = ${charCount} chars) " + 37 "(total size = ${charCount} chars) "
38 "in ${timer.elapsedInMs()}ms"); 38 "in ${timer.elapsedInMs()}ms");
39 } 39 }
40 bar.end(); 40 bar.end();
41 } 41 }
42 42
43 int tokenizeOne(String filename) { 43 int tokenizeOne(String filename) {
44 return getBytes(filename, (bytes) { 44 return getBytes(filename, (bytes) {
45 Scanner scanner = makeScanner(bytes); 45 Scanner scanner = makeScanner(bytes);
46 try { 46 try {
47 printTokens(scanner.tokenize()); 47 printTokens(scanner.tokenize());
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 void end() { 142 void end() {
143 } 143 }
144 144
145 void recordScore(num score) { 145 void recordScore(num score) {
146 if (total > 10) { 146 if (total > 10) {
147 print("$ticks, $score, ${ticks * 100 ~/ total}%"); 147 print("$ticks, $score, ${ticks * 100 ~/ total}%");
148 } 148 }
149 } 149 }
150 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698