Add _.reject benchmark.

Former-commit-id: 936a8b8915522abd5a64bbb2c7756a36a4af7c30
This commit is contained in:
John-David Dalton
2012-10-14 01:40:50 -07:00
parent 62e9c7c75a
commit 82a6cfc03a

View File

@@ -1238,6 +1238,50 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.reject` iterating an array')
.add('Lo-Dash', '\
lodash.reject(numbers, function(num) {\
return num % 2;\
})'
)
.add('Underscore', '\
_.reject(numbers, function(num) {\
return num % 2;\
})'
)
);
suites.push(
Benchmark.Suite('`_.reject` iterating an array with `thisArg` (slow path)')
.add('Lo-Dash', '\
lodash.reject(numbers, function(num, index) {\
return this["key" + index] % 2;\
}, object)'
)
.add('Underscore', '\
_.reject(numbers, function(num, index) {\
return this["key" + index] % 2;\
}, object)'
)
);
suites.push(
Benchmark.Suite('`_.reject` iterating an object')
.add('Lo-Dash', '\
lodash.reject(object, function(num) {\
return num % 2\
})'
)
.add('Underscore', '\
_.reject(object, function(num) {\
return num % 2\
})'
)
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.shuffle`')
.add('Lo-Dash', '\