Ensure _.isEqual works correctly for objects from another document and add _.clone benchmark.

Former-commit-id: b1ef745ec6c24e8ea0c8fae304ead80c60dfd5aa
This commit is contained in:
John-David Dalton
2012-07-29 00:58:23 -07:00
parent 943004844a
commit 86bd847bf9
5 changed files with 173 additions and 93 deletions

View File

@@ -132,7 +132,10 @@
// potentially expensive
for (index = 0; index < this.count; index++) {
bindAllObjects[index] = belt.clone(lodash);
bindAllObjects[index] = belt.reduce(funcNames, function(object, funcName) {
object[funcName] = lodash[funcName];
return object;
}, {});
}
}
@@ -515,6 +518,18 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.clone` with an object')
.add('Lo-Dash', function() {
lodash.clone(object);
})
.add('Underscore', function() {
_.clone(object);
})
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.countBy` with `callback` iterating an array')
.add('Lo-Dash', function() {
@@ -1145,16 +1160,6 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.size` with an array')
.add('Lo-Dash', function() {
lodash.size(numbers);
})
.add('Underscore', function() {
_.size(numbers);
})
);
suites.push(
Benchmark.Suite('`_.size` with an object')
.add('Lo-Dash', function() {