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

@@ -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', {