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

Side by Side Diff: benchmark/benchmark.dart

Issue 1327733002: Limit the number of benchmark trials. (Closed) Base URL: git@github.com:dart-lang/yaml@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | 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
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 yaml.benchmark.benchmark; 5 library yaml.benchmark.benchmark;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
11 11
12 import 'package:yaml/yaml.dart'; 12 import 'package:yaml/yaml.dart';
13 13
14 const numTrials = 10000000; 14 const numTrials = 100;
15 const runsPerTrial = 1000; 15 const runsPerTrial = 1000;
16 16
17 final source = loadFile("input.yaml"); 17 final source = loadFile("input.yaml");
18 final expected = loadFile("output.json"); 18 final expected = loadFile("output.json");
19 19
20 void main(List<String> args) { 20 void main(List<String> args) {
21 var best = double.INFINITY; 21 var best = double.INFINITY;
22 22
23 // Run the benchmark several times. This ensures the VM is warmed up and lets 23 // Run the benchmark several times. This ensures the VM is warmed up and lets
24 // us see how much variance there is. 24 // us see how much variance there is.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 String padLeft(input, int length) { 67 String padLeft(input, int length) {
68 var result = input.toString(); 68 var result = input.toString();
69 if (result.length < length) { 69 if (result.length < length) {
70 result = " " * (length - result.length) + result; 70 result = " " * (length - result.length) + result;
71 } 71 }
72 72
73 return result; 73 return result;
74 } 74 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698