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

Side by Side Diff: frog/leg/scanner/parser_bench.dart

Issue 8537011: Rename StopWatch to Stopwatch. Add new Stopwatch.start() and Stopwatch.reset(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Make StopwatchTest diffable. Created 9 years, 1 month 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** 5 /**
6 * A benchmark for the Dart parser. 6 * A benchmark for the Dart parser.
7 */ 7 */
8 class ParserBench extends BaseParserBench { 8 class ParserBench extends BaseParserBench {
9 Token scanFileNamed(String filename) { 9 Token scanFileNamed(String filename) {
10 Token token; 10 Token token;
11 getBytes(filename, (bytes) { 11 getBytes(filename, (bytes) {
12 Scanner scanner = makeScanner(bytes); 12 Scanner scanner = makeScanner(bytes);
13 try { 13 try {
14 token = scanner.tokenize(); 14 token = scanner.tokenize();
15 } catch (MalformedInputException e) { 15 } catch (MalformedInputException e) {
16 print("${filename}: ${e}"); 16 print("${filename}: ${e}");
17 } 17 }
18 }); 18 });
19 return token; 19 return token;
20 } 20 }
21 21
22 void timedParseAll(List<String> arguments) { 22 void timedParseAll(List<String> arguments) {
23 StopWatch timer = new StopWatch(); 23 Stopwatch timer = new Stopwatch();
24 timer.start(); 24 timer.start();
25 BenchListener listener = parseAll(arguments); 25 BenchListener listener = parseAll(arguments);
26 timer.stop(); 26 timer.stop();
27 print("Parsing (${listener.libraryTagCount} tags, " 27 print("Parsing (${listener.libraryTagCount} tags, "
28 + "${listener.classCount} classes, " 28 + "${listener.classCount} classes, "
29 + "${listener.interfaceCount} interfaces, " 29 + "${listener.interfaceCount} interfaces, "
30 + "${listener.aliasCount} typedefs, " 30 + "${listener.aliasCount} typedefs, "
31 + "${listener.topLevelMemberCount} top-level members) " 31 + "${listener.topLevelMemberCount} top-level members) "
32 + "took ${timer.elapsedInMs()}ms"); 32 + "took ${timer.elapsedInMs()}ms");
33 } 33 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 94
95 void beginClass(Token token) { 95 void beginClass(Token token) {
96 classCount++; 96 classCount++;
97 } 97 }
98 98
99 void beginFunctionTypeAlias(Token token) { 99 void beginFunctionTypeAlias(Token token) {
100 aliasCount++; 100 aliasCount++;
101 } 101 }
102 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698