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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « lib/binary/ast_to_binary.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
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.
4 import 'package:kernel/kernel.dart';
5 import 'dart:io';
6
7 final String usage = '''
8 Usage: serialize_bench INPUT.dill OUTPUT.dill
9
10 Deserialize INPUT and write it back to OUTPUT several times, measuring
11 the time it takes, including I/O time.
12 ''';
13
14 main(List<String> args) async {
15 if (args.length != 2) {
16 print(usage);
17 exit(1);
18 }
19 Program program = loadProgramFromBinary(args[0]);
20
21 String destination = args[1];
22 var watch = new Stopwatch()..start();
23 await writeProgramToBinary(program, destination);
24 int coldTime = watch.elapsedMilliseconds;
25
26 watch.reset();
27 int numTrials = 10;
28 for (int i = 0; i < numTrials; ++i) {
29 await writeProgramToBinary(program, destination);
30 }
31 double hotTime = watch.elapsedMilliseconds / numTrials;
32
33 print('Cold time: $coldTime ms');
34 print('Hot time: $hotTime ms');
35 }
OLDNEW
« 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