mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Reduce _.wrap by taking advantage of createBound.
This commit is contained in:
26
perf/perf.js
26
perf/perf.js
@@ -537,6 +537,18 @@
|
||||
lodashFindWhere = lodash.findWhere || lodash.find,\
|
||||
whereObject = { "num": 9 };\
|
||||
}\
|
||||
if (typeof wrap != "undefined") {\
|
||||
var add = function(a, b) {\
|
||||
return a + b;\
|
||||
};\
|
||||
\
|
||||
var average = function(func, a, b) {\
|
||||
return (func(a, b) / 2).toFixed(2);\
|
||||
};\
|
||||
\
|
||||
var _wrapped = _.wrap(add, average);\
|
||||
lodashWrapped = lodash.wrap(add, average);\
|
||||
}\
|
||||
if (typeof zip != "undefined") {\
|
||||
var unzipped = [["a", "b", "c"], [1, 2, 3], [true, false, true]];\
|
||||
}'
|
||||
@@ -1946,6 +1958,20 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.wrap` result called')
|
||||
.add(buildName, {
|
||||
'fn': 'lodashWrapped(2, 5)',
|
||||
'teardown': 'function wrap(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_wrapped(2, 5)',
|
||||
'teardown': 'function wrap(){}'
|
||||
})
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.zip`')
|
||||
.add(buildName, {
|
||||
|
||||
Reference in New Issue
Block a user