mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Update vendor/underscore and add _.indexBy perf and unit tests.
Former-commit-id: 5fc6c853773385aa39d470429899a35f9f17cad8
This commit is contained in:
55
perf/perf.js
55
perf/perf.js
@@ -287,10 +287,17 @@
|
||||
};\
|
||||
\
|
||||
var _boundNormal = _.bind(func, thisArg),\
|
||||
_boundMultiple = = _boundNormal,\
|
||||
_boundPartial = _.bind(func, thisArg, "hi");\
|
||||
\
|
||||
var lodashBoundNormal = lodash.bind(func, thisArg),\
|
||||
lodashBoundMultiple = lodashBoundNormal,\
|
||||
lodashBoundPartial = lodash.bind(func, thisArg, "hi");\
|
||||
\
|
||||
for (index = 0; index < 10; index++) {\
|
||||
_boundMultiple = _.bind(_boundMultiple, { "name": "moe" + index });\
|
||||
lodashBoundMultiple = lodash.bind(lodashBoundMultiple, { "name": "moe" + index });\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
if (typeof bindAll != "undefined") {\
|
||||
@@ -643,6 +650,18 @@
|
||||
})
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('bound multiple times')
|
||||
.add(buildName, {
|
||||
'fn': 'lodashBoundMultiple()',
|
||||
'teardown': 'function bind(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_boundMultiple()',
|
||||
'teardown': 'function bind(){}'
|
||||
})
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
@@ -1066,6 +1085,42 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.indexBy` with `callback` iterating an array')
|
||||
.add(buildName, '\
|
||||
lodash.indexBy(numbers, function(num) { return num >> 1; })'
|
||||
)
|
||||
.add(otherName, '\
|
||||
_.indexBy(numbers, function(num) { return num >> 1; })'
|
||||
)
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.indexBy` with `property` name iterating an array')
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.indexBy(words, "length")',
|
||||
'teardown': 'function countBy(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_.indexBy(words, "length")',
|
||||
'teardown': 'function countBy(){}'
|
||||
})
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.indexBy` with `callback` iterating an object')
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.indexBy(wordToNumber, function(num) { return num >> 1; })',
|
||||
'teardown': 'function countBy(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_.indexBy(wordToNumber, function(num) { return num >> 1; })',
|
||||
'teardown': 'function countBy(){}'
|
||||
})
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.indexOf`')
|
||||
.add(buildName, {
|
||||
|
||||
Reference in New Issue
Block a user