fix(benchpress): only print the CV when it is meaningful
When the mean is 0, the coefficient of variation is calculated to be NaN, which is not meaningful, so instead of printing "+-NaN%", just don't print the CV at all. Closes #908 Closes #1444
This commit is contained in:
committed by
Misko Hevery
parent
4650d25a53
commit
642e7e5c46
@@ -83,10 +83,10 @@ export class ConsoleReporter extends Reporter {
|
||||
var sample = ListWrapper.map(validSample, (measureValues) => measureValues.values[metricName]);
|
||||
var mean = Statistic.calculateMean(sample);
|
||||
var cv = Statistic.calculateCoefficientOfVariation(sample, mean);
|
||||
var formattedCv = NumberWrapper.isNaN(cv) ? 'NaN' : Math.floor(cv);
|
||||
var formattedMean = ConsoleReporter._formatNum(mean)
|
||||
// Note: Don't use the unicode character for +- as it might cause
|
||||
// hickups consoles...
|
||||
return `${ConsoleReporter._formatNum(mean)}+-${formattedCv}%`;
|
||||
// hickups for consoles...
|
||||
return NumberWrapper.isNaN(cv) ? formattedMean : `${formattedMean}+-${Math.floor(cv)}%`;
|
||||
})
|
||||
);
|
||||
return PromiseWrapper.resolve(null);
|
||||
|
||||
Reference in New Issue
Block a user