Optimize _.isArray fallback, baseFlatten, & _.isArguments for plain objects.

This commit is contained in:
John-David Dalton
2013-09-17 08:58:18 -07:00
parent 9f2b1b03d7
commit 55f080e33f
8 changed files with 116 additions and 93 deletions

View File

@@ -270,6 +270,7 @@
numbers = Array(limit),\
fourNumbers = [5, 25, 10, 30],\
nestedNumbers = [1, [2], [3, [[4]]]],\
nestedObjects = [{}, [{}], [{}, [[{}]]]],\
twoNumbers = [12, 23];\
\
for (index = 0; index < limit; index++) {\
@@ -1025,6 +1026,16 @@
)
);
suites.push(
Benchmark.Suite('`_.flatten` with objects')
.add(buildName, '\
lodash.flatten(nestedObjects)'
)
.add(otherName, '\
_.flatten(nestedObjects)'
)
);
suites.push(
Benchmark.Suite('`_.flatten` with `shallow`')
.add(buildName, '\