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

Unified Diff: utils/tests/string_encoding/benchmark_runner.dart

Issue 11748016: Make ~/, round, ceil, floor, truncate return ints. Remove toInt. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Checked mode fixes. Created 7 years, 12 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 side-by-side diff with in-line comments
Download patch
Index: utils/tests/string_encoding/benchmark_runner.dart
diff --git a/utils/tests/string_encoding/benchmark_runner.dart b/utils/tests/string_encoding/benchmark_runner.dart
index f92c59389eb2ede09f90ace2dd3b96dcfc6297a0..48c0b4a4523904778f6e48ac8ccbd4b61742db51 100644
--- a/utils/tests/string_encoding/benchmark_runner.dart
+++ b/utils/tests/string_encoding/benchmark_runner.dart
@@ -58,11 +58,11 @@ class PerformanceModel {
overheadNanos =
((((sumY * sumXSquared) - (sumX * sumXY)) /
- ((n * sumXSquared) - (sumX * sumX))) / source.length).toInt();
+ ((n * sumXSquared) - (sumX * sumX))) / source.length).truncate();
Lasse Reichstein Nielsen 2013/01/04 10:29:42 Indent by one more here.
perRequestNanos =
(((n * sumXY) - (sumX * sumY)) /
- ((n * sumXSquared) - (sumX * sumX))).toInt();
+ ((n * sumXSquared) - (sumX * sumX))).truncate();
Lasse Reichstein Nielsen 2013/01/04 10:29:42 Ditto.
}
}
@@ -72,14 +72,14 @@ class PerformanceModel {
int perRequestNanos;
int repsFor(int targetDurationNanos, [int blocksize = -1]) {
if (blocksize <= 0) {
- return ((targetDurationNanos - overheadNanos) / perRequestNanos).toInt();
+ return ((targetDurationNanos - overheadNanos) / perRequestNanos).truncate();
Lasse Reichstein Nielsen 2013/01/04 10:29:42 Long line. Use ~/ ?
} else {
int blockTime = overheadNanos + (blocksize * perRequestNanos);
int fullBlocks = targetDurationNanos ~/ blockTime;
int extraReps =
((targetDurationNanos - (fullBlocks * blockTime)) - overheadNanos)
~/ perRequestNanos;
- return ((fullBlocks * blocksize) + extraReps).toInt();
+ return ((fullBlocks * blocksize) + extraReps).truncate();
Lasse Reichstein Nielsen 2013/01/04 10:29:42 All operands are int, so drop truncate.
}
}
}
@@ -104,8 +104,8 @@ class TestReport {
}
int resultsMeanNanos() =>
- (BlockSample._totalTime(results) /
- BlockSample._totalCount(results)).toInt();
+ (BlockSample._totalTime(results) ~/
+ BlockSample._totalCount(results));
Lasse Reichstein Nielsen 2013/01/04 10:29:42 Indent by 1 more, or put on same line if possible.
floitsch 2013/03/11 13:39:15 Done in a different CL.
int resultsWorstNanos() {
BlockSample worst = worstBlock(results);
@@ -185,7 +185,7 @@ class TestReport {
if (val.isInfinite || val.isNaN) {
return "NaN";
} else {
- return val.toInt().toString();
+ return val.truncate().toString();
Lasse Reichstein Nielsen 2013/01/04 10:29:42 .toStringAsFixed(0)
}
}
« tools/testing/dart/test_progress.dart ('K') | « tools/testing/dart/test_progress.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698