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

Unified Diff: test/serialize_bench.dart

Issue 2507723002: Remove unnecessary indexing passes from serialization. (Closed)
Patch Set: Add copyright Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/binary/ast_to_binary.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/serialize_bench.dart
diff --git a/test/serialize_bench.dart b/test/serialize_bench.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f19e1afebe6b56841c573bb32ffc07b81eb175d8
--- /dev/null
+++ b/test/serialize_bench.dart
@@ -0,0 +1,35 @@
+// 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 file.
+import 'package:kernel/kernel.dart';
+import 'dart:io';
+
+final String usage = '''
+Usage: serialize_bench INPUT.dill OUTPUT.dill
+
+Deserialize INPUT and write it back to OUTPUT several times, measuring
+the time it takes, including I/O time.
+''';
+
+main(List<String> args) async {
+ if (args.length != 2) {
+ print(usage);
+ exit(1);
+ }
+ Program program = loadProgramFromBinary(args[0]);
+
+ String destination = args[1];
+ var watch = new Stopwatch()..start();
+ await writeProgramToBinary(program, destination);
+ int coldTime = watch.elapsedMilliseconds;
+
+ watch.reset();
+ int numTrials = 10;
+ for (int i = 0; i < numTrials; ++i) {
+ await writeProgramToBinary(program, destination);
+ }
+ double hotTime = watch.elapsedMilliseconds / numTrials;
+
+ print('Cold time: $coldTime ms');
+ print('Hot time: $hotTime ms');
+}
« no previous file with comments | « lib/binary/ast_to_binary.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698