| OLD | NEW |
| 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; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 Listener listener = new BenchListener(); | 36 Listener listener = new BenchListener(); |
| 37 for (String argument in arguments) { | 37 for (String argument in arguments) { |
| 38 parseFileNamed(argument, listener); | 38 parseFileNamed(argument, listener); |
| 39 } | 39 } |
| 40 return listener; | 40 return listener; |
| 41 } | 41 } |
| 42 | 42 |
| 43 void parseFileNamed(String argument, Listener listener) { | 43 void parseFileNamed(String argument, Listener listener) { |
| 44 bool failed = true; | 44 bool failed = true; |
| 45 try { | 45 try { |
| 46 Parser parser = new Parser(listener); | 46 PartialParser parser = new PartialParser(listener); |
| 47 parser.parseUnit(scanFileNamed(argument)); | 47 parser.parseUnit(scanFileNamed(argument)); |
| 48 failed = false; | 48 failed = false; |
| 49 } finally { | 49 } finally { |
| 50 if (failed) print('Error in ${argument}'); | 50 if (failed) print('Error in ${argument}'); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 void main(List<String> arguments) { | 54 void main(List<String> arguments) { |
| 55 for (int i = 0; i < 10; i++) { | 55 for (int i = 0; i < 10; i++) { |
| 56 timedParseAll(arguments); | 56 timedParseAll(arguments); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |