Add percent faster than to pref.js results and link to benchmarks in README.md.

Former-commit-id: 1c5fb820fe070599aba780f1765538d408105af3
This commit is contained in:
John-David Dalton
2012-05-30 03:51:44 -04:00
parent a67281f8e7
commit 0d2a1641c9
2 changed files with 11 additions and 5 deletions

View File

@@ -99,8 +99,8 @@
lodashHz = underscoreHz = Math.min(lodashHz, underscoreHz);
}
else {
var slowestHz = slowest[0] == this[0] ? lodashHz : underscoreHz,
fastestHz = fastest[0] == this[0] ? lodashHz : underscoreHz,
var fastestHz = fastest[0] == this[0] ? lodashHz : underscoreHz,
slowestHz = slowest[0] == this[0] ? lodashHz : underscoreHz,
percent = Math.round(((fastestHz / slowestHz) - 1) * 100);
console.log(fastest[0].name + ' is ' + percent + '% faster.');
@@ -117,11 +117,17 @@
suites[0].run();
}
else {
var fastestTotalHz = Math.max(score.lodash, score.underscore),
slowestTotalHz = Math.min(score.lodash, score.underscore),
totalPercent = Math.round(((fastestTotalHz / slowestTotalHz) - 1) * 100),
totalX = (fastestTotalHz / slowestTotalHz).toFixed(2),
message = ' is ' + totalPercent + '% (' + totalX + 'x) faster than ';
// report results
if (score.lodash >= score.underscore) {
console.log('\nLo-Dash is ' + (score.lodash / score.underscore).toFixed(2) + 'x faster than Underscore.');
console.log('\nLo-Dash' + message + 'Underscore.');
} else {
console.log('\nUnderscore is ' + (score.underscore / score.lodash).toFixed(2) + 'x faster than Lo-Dash.');
console.log('\nUnderscore' + message + 'Lo-Dash.');
}
}
}