Add _.invoke benchmark to perf.js and a link to the compatibility changes wiki entry in README.md.

Former-commit-id: 51296709ea8d9dd6e951530b9874b90af3c764a2
This commit is contained in:
John-David Dalton
2012-07-14 06:21:59 -04:00
parent 139693dce6
commit c9c83ee7e6
2 changed files with 36 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
# Lo-Dash <sup>v0.4.1</sup>
A drop-in replacement for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), that delivers [performance improvements](http://lodash.com/benchmarks), [bug fixes](https://github.com/bestiejs/lodash#closed-underscorejs-issues), and [additional features](https://github.com/bestiejs/lodash#features).
A drop-in replacement<sup>[*](https://github.com/bestiejs/lodash/wiki/Drop-in-Disclaimer)</sup> for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), that delivers [performance improvements](http://lodash.com/benchmarks), [bug fixes](https://github.com/bestiejs/lodash#closed-underscorejs-issues), and [additional features](https://github.com/bestiejs/lodash#features).
Lo-Dashs performance is gained by avoiding slower native methods, instead opting for simplified non-ES5 compliant methods optimized for common usage, and by leveraging function compilation to reduce the number of overall function calls.

View File

@@ -602,12 +602,12 @@
suites.push(
Benchmark.Suite('`_.find` iterating an object')
.add('Lo-Dash', function() {
lodash.find(numbers, function(value, key) {
lodash.find(object, function(value, key) {
return /\D9$/.test(key);
});
})
.add('Underscore', function() {
_.find(numbers, function(value, key) {
_.find(object, function(value, key) {
return /\D9$/.test(key);
});
})
@@ -727,6 +727,39 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.invoke` iterating an array')
.add('Lo-Dash', function() {
lodash.invoke(numbers, 'toFixed', '2');
})
.add('Underscore', function() {
_.invoke(numbers, 'toFixed', '2');
})
);
suites.push(
Benchmark.Suite('`_.invoke` with a function for `methodName` iterating an array')
.add('Lo-Dash', function() {
lodash.invoke(numbers, String.prototype.split, '');
})
.add('Underscore', function() {
_.invoke(numbers, String.prototype.split, '');
})
);
suites.push(
Benchmark.Suite('`_.invoke` iterating an object')
.add('Lo-Dash', function() {
lodash.invoke(object, 'toFixed', '2');
})
.add('Underscore', function() {
_.invoke(object, 'toFixed', '2');
})
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.isEqual` comparing primitives and objects (edge case)')
.add('Lo-Dash', {