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

Unified Diff: pkg/dart_scanner/lib/src/main.dart

Issue 2631503002: Modify scanner and parser to be standalone packages. (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: pkg/dart_scanner/lib/src/main.dart
diff --git a/pkg/dart_scanner/lib/src/main.dart b/pkg/dart_scanner/lib/src/main.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c99385333a76046b0ec1449635dcef46913bb2bf
--- /dev/null
+++ b/pkg/dart_scanner/lib/src/main.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+import '../io.dart' show
+ readBytesFromFileSync;
+
+import '../scanner.dart' show
+ scan;
+
+scanAll(Map<Uri, List<int>> files) {
+ Stopwatch sw = new Stopwatch()..start();
+ int byteCount = 0;
+ files.forEach((Uri uri, List<int> bytes) {
+ scan(bytes);
+ byteCount += bytes.length - 1;
+ });
+ sw.stop();
+ print("Scanning files took: ${sw.elapsed}");
+ print("Bytes/ms: ${byteCount/sw.elapsedMilliseconds}");
+}
+
+main(List<String> arguments) {
+ Map<Uri, List<int>> files = <Uri, List<int>>{};
+ Stopwatch sw = new Stopwatch()..start();
+ for (String name in arguments) {
+ Uri uri = Uri.base.resolve(name);
+ List<int> bytes = readBytesFromFileSync(uri);
+ files[uri] = bytes;
+ }
+ sw.stop();
+ print("Reading files took: ${sw.elapsed}");
+ scanAll(files);
+}

Powered by Google App Engine
This is Rietveld 408576698