OLD | NEW |
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('node_scanner_bench'); | 5 #library('node_scanner_bench'); |
6 #import('../../lib/node/node.dart'); | 6 #import('../../node/node.dart'); |
7 #import('scannerlib.dart'); | 7 #import('scannerlib.dart'); |
8 #import('scanner_implementation.dart'); | 8 #import('scanner_implementation.dart'); |
9 #import('scanner_bench.dart'); | 9 #import('scanner_bench.dart'); |
10 #import('../../../lib/utf/utf.dart'); | 10 #import('../../../utf/utf.dart'); |
11 #source('byte_strings.dart'); | 11 #source('byte_strings.dart'); |
12 #source('byte_array_scanner.dart'); | 12 #source('byte_array_scanner.dart'); |
13 | 13 |
14 class NodeScannerBench extends ScannerBench { | 14 class NodeScannerBench extends ScannerBench { |
15 int getBytes(String filename, void callback(bytes)) { | 15 int getBytes(String filename, void callback(bytes)) { |
16 // This actually returns a buffer, not a String. | 16 // This actually returns a buffer, not a String. |
17 var s = fs.readFileSync(filename, null); | 17 var s = fs.readFileSync(filename, null); |
18 callback(s); | 18 callback(s); |
19 return s.length; | 19 return s.length; |
20 } | 20 } |
(...skipping 18 matching lines...) Expand all Loading... |
39 // inline. | 39 // inline. |
40 int index = ++byteOffset; | 40 int index = ++byteOffset; |
41 int next = (bytes.length > index) ? bytes[index] : $EOF; | 41 int next = (bytes.length > index) ? bytes[index] : $EOF; |
42 return next; | 42 return next; |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 main() { | 46 main() { |
47 new NodeScannerBench().main(argv); | 47 new NodeScannerBench().main(argv); |
48 } | 48 } |
OLD | NEW |