Skip to content

Commit ce4612d

Browse files
jensjohaCommit Queue
authored andcommitted
[CFE] Add mean absolute numbers to TTestResult; print mean from -> to in benchmarker
Change-Id: If935f5d9668cc1bd12ba3e2af7ae55f3bdea141f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421182 Commit-Queue: Jens Johansen <[email protected]> Reviewed-by: Johnni Winther <[email protected]>
1 parent b2f0b8d commit ce4612d

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

pkg/front_end/test/simple_stats.dart

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ class SimpleTTestStat {
2727
if (confidence < diffMean.abs()) {
2828
double percentDiff = diffMean * 100 / bMean;
2929
double percentDiffConfidence = confidence * 100 / bMean;
30-
return new TTestResult(
31-
true, percentDiff, percentDiffConfidence, diffMean, confidence);
30+
return new TTestResult(true, percentDiff, percentDiffConfidence, diffMean,
31+
confidence, aMean, bMean);
3232
} else {
33-
return new TTestResult(false, 0, 0, 0, 0);
33+
return new TTestResult(false, 0, 0, 0, 0, 0, 0);
3434
}
3535
}
3636

@@ -106,9 +106,11 @@ class TTestResult {
106106
final double percentDiffConfidence;
107107
final double diff;
108108
final double confidence;
109+
final double aMean;
110+
final double bMean;
109111

110112
TTestResult(this.significant, this.percentDiff, this.percentDiffConfidence,
111-
this.diff, this.confidence);
113+
this.diff, this.confidence, this.aMean, this.bMean);
112114

113115
@override
114116
String toString() {
@@ -145,4 +147,11 @@ class TTestResult {
145147
"+/- "
146148
"${_format(confidence, fractionDigits: fractionDigits)}";
147149
}
150+
151+
String? meanChangeStringIfSignificant({int fractionDigits = 2}) {
152+
if (!significant) return null;
153+
return "${_format(bMean, fractionDigits: fractionDigits)} "
154+
"-> "
155+
"${_format(aMean, fractionDigits: fractionDigits)}";
156+
}
148157
}

pkg/front_end/tool/benchmarker.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ bool _compare(List<Map<String, num>> from, List<Map<String, num>> to) {
182182
if (stats.significant) {
183183
somethingWasSignificant = true;
184184
print("$caption: ${stats.percentChangeIfSignificant(fractionDigits: 4)} "
185-
"(${stats.valueChangeIfSignificant(fractionDigits: 2)})");
185+
"(${stats.valueChangeIfSignificant(fractionDigits: 2)}) "
186+
"(${stats.meanChangeStringIfSignificant(fractionDigits: 2)})");
186187
}
187188
}
188189
return somethingWasSignificant;

0 commit comments

Comments
 (0)