Add _.partition.

This commit is contained in:
John-David Dalton
2014-02-08 23:27:04 -08:00
parent dabea8b972
commit a91abb3e8d
9 changed files with 384 additions and 123 deletions

View File

@@ -1533,6 +1533,50 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.partition` iterating an array')
.add(buildName, '\
lodash.partition(numbers, function(num) {\
return num % 2;\
})'
)
.add(otherName, '\
_.partition(numbers, function(num) {\
return num % 2;\
})'
)
);
suites.push(
Benchmark.Suite('`_.partition` iterating an array with `thisArg` (slow path)')
.add(buildName, '\
lodash.partition(numbers, function(num, index) {\
return this["key" + index] % 2;\
}, object)'
)
.add(otherName, '\
_.partition(numbers, function(num, index) {\
return this["key" + index] % 2;\
}, object)'
)
);
suites.push(
Benchmark.Suite('`_.partition` iterating an object')
.add(buildName, '\
lodash.partition(object, function(num) {\
return num % 2;\
})'
)
.add(otherName, '\
_.partition(object, function(num) {\
return num % 2;\
})'
)
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.pick`')
.add(buildName, '\
@@ -1657,12 +1701,12 @@
Benchmark.Suite('`_.reject` iterating an object')
.add(buildName, '\
lodash.reject(object, function(num) {\
return num % 2\
return num % 2;\
})'
)
.add(otherName, '\
_.reject(object, function(num) {\
return num % 2\
return num % 2;\
})'
)
);