From 82a6cfc03a2088769eba8bd71d9254d4e050466c Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 14 Oct 2012 01:40:50 -0700 Subject: [PATCH] Add `_.reject` benchmark. Former-commit-id: 936a8b8915522abd5a64bbb2c7756a36a4af7c30 --- perf/perf.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/perf/perf.js b/perf/perf.js index ae3ff2c41..040784f77 100644 --- a/perf/perf.js +++ b/perf/perf.js @@ -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', '\