Use readAsBytesSync in standard_file_system.dart as it is faster
Timing how long fasta spends on *reading* files when compiling dart2js
(when compiling via the VM) I get a good speedup:
Difference at 95.0% confidence
-84031.2 +/- 10333.7
-47.4004% +/- 5.82904%
(Student's t, pooled s = 7085.44)
Change-Id: I0bb1a1fe6f9d430b47515b9b319069bf810d0aeb
Reviewed-on: https://dart-review.googlesource.com/c/85442
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
diff --git a/pkg/front_end/lib/src/api_prototype/standard_file_system.dart b/pkg/front_end/lib/src/api_prototype/standard_file_system.dart
index 5be815e..bdd78ad 100644
--- a/pkg/front_end/lib/src/api_prototype/standard_file_system.dart
+++ b/pkg/front_end/lib/src/api_prototype/standard_file_system.dart
@@ -63,7 +63,7 @@
Future<List<int>> readAsBytes() async {
try {
CompilerContext.recordDependency(uri);
- return await new io.File.fromUri(uri).readAsBytes();
+ return new io.File.fromUri(uri).readAsBytesSync();
} on io.FileSystemException catch (exception) {
throw _toFileSystemException(exception);
}