mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Add percent faster than to pref.js results and link to benchmarks in README.md.
Former-commit-id: 1c5fb820fe070599aba780f1765538d408105af3
This commit is contained in:
14
perf/perf.js
14
perf/perf.js
@@ -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.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user