Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function printFastest(suite) {
var formatNumber = Benchmark.formatNumber,
fastest = suite.filter('fastest'),
fastestHz = getHz(fastest[0]),
slowest = suite.filter('slowest'),
slowestHz = getHz(slowest[0]),
aHz = getHz(suite[0]),
bHz = getHz(suite[1]);
if (fastest.length > 1) {
console.log('It\'s too close to call.');
aHz = bHz = slowestHz;
} else {
var percent = ((fastestHz / slowestHz) - 1) * 100;
console.log(' ' + fastest[0].name + ' is ' +
formatNumber(percent < 1 ? percent.toFixed(2) : Math.round(percent)) +
'% faster.');
}
}