mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
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:
@@ -1,6 +1,6 @@
|
|||||||
# Lo-Dash <sup>v0.4.1</sup>
|
# 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-Dash’s 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.
|
Lo-Dash’s 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.
|
||||||
|
|
||||||
|
|||||||
37
perf/perf.js
37
perf/perf.js
@@ -602,12 +602,12 @@
|
|||||||
suites.push(
|
suites.push(
|
||||||
Benchmark.Suite('`_.find` iterating an object')
|
Benchmark.Suite('`_.find` iterating an object')
|
||||||
.add('Lo-Dash', function() {
|
.add('Lo-Dash', function() {
|
||||||
lodash.find(numbers, function(value, key) {
|
lodash.find(object, function(value, key) {
|
||||||
return /\D9$/.test(key);
|
return /\D9$/.test(key);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.add('Underscore', function() {
|
.add('Underscore', function() {
|
||||||
_.find(numbers, function(value, key) {
|
_.find(object, function(value, key) {
|
||||||
return /\D9$/.test(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(
|
suites.push(
|
||||||
Benchmark.Suite('`_.isEqual` comparing primitives and objects (edge case)')
|
Benchmark.Suite('`_.isEqual` comparing primitives and objects (edge case)')
|
||||||
.add('Lo-Dash', {
|
.add('Lo-Dash', {
|
||||||
|
|||||||
Reference in New Issue
Block a user