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

Side by Side Diff: utils/tests/string_encoding/benchmark_runner.dart

Issue 13863012: Refactor List.setRange function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « tools/dom/templates/immutable_list_mixin.darttemplate ('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
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of BenchmarkTests; 5 part of BenchmarkTests;
6 6
7 /** 7 /**
8 * The results of a single block of tests (count times run, overall time). 8 * The results of a single block of tests (count times run, overall time).
9 */ 9 */
10 class BlockSample { 10 class BlockSample {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 String _leftAlign(String s, int width) { 170 String _leftAlign(String s, int width) {
171 List<int> outCodes = []; 171 List<int> outCodes = [];
172 outCodes.insertRange(0, width, spaceChar); 172 outCodes.insertRange(0, width, spaceChar);
173 outCodes.setRange(0, Math.min(width, s.length), s.codeUnits); 173 outCodes.setRange(0, Math.min(width, s.length), s.codeUnits);
174 return new String.fromCharCodes(outCodes); 174 return new String.fromCharCodes(outCodes);
175 } 175 }
176 176
177 String _rightAlign(String s, int width) { 177 String _rightAlign(String s, int width) {
178 List<int> outCodes = []; 178 List<int> outCodes = [];
179 outCodes.insertRange(0, width, spaceChar); 179 outCodes.insertRange(0, width, spaceChar);
180 outCodes.setRange(Math.max(0, width - s.length), Math.min(width, s.length), 180 int fromIndex = Math.max(0, width - s.length);
181 s.codeUnits); 181 int length = Math.min(width, s.length);
182 outCodes.setRange(fromIndex, fromIndex + length, s.codeUnits);
182 return new String.fromCharCodes(outCodes); 183 return new String.fromCharCodes(outCodes);
183 } 184 }
184 185
185 static String _stringifyDoubleAsInt(double val) { 186 static String _stringifyDoubleAsInt(double val) {
186 if (val.isInfinite || val.isNaN) { 187 if (val.isInfinite || val.isNaN) {
187 return "NaN"; 188 return "NaN";
188 } else { 189 } else {
189 return val.toInt().toString(); 190 return val.toInt().toString();
190 } 191 }
191 } 192 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 _(TestReport r) => r.printReport() : reportHandler; 452 _(TestReport r) => r.printReport() : reportHandler;
452 } 453 }
453 454
454 Function _reportHandler; 455 Function _reportHandler;
455 Function get reportHandler => _reportHandler; 456 Function get reportHandler => _reportHandler;
456 int _warmup; 457 int _warmup;
457 int _targetTimeMs; 458 int _targetTimeMs;
458 int _minSampleTimeMs; 459 int _minSampleTimeMs;
459 int _blocksize; 460 int _blocksize;
460 } 461 }
OLDNEW
« no previous file with comments | « tools/dom/templates/immutable_list_mixin.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698