mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Add _.compact, _.defaults, and _.extend benchmarks.
Former-commit-id: adebc01aeda08323174af63166c2b6e0e798c313
This commit is contained in:
44
perf/perf.js
44
perf/perf.js
@@ -224,6 +224,12 @@
|
||||
}, {});\
|
||||
}\
|
||||
}\
|
||||
if (typeof compact != "undefined") {\
|
||||
var uncompacted = numbers.slice();\
|
||||
uncompacted[2] = false;\
|
||||
uncompacted[6] = null;\
|
||||
uncompacted[18] = "";\
|
||||
}\
|
||||
\
|
||||
if (typeof countBy != "undefined" || typeof omit != "undefined") {\
|
||||
var wordToNumber = {\
|
||||
@@ -537,6 +543,20 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.compact`')
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.compact(uncompacted)',
|
||||
'teardown': 'function compact(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_.compact(uncompacted)',
|
||||
'teardown': 'function compact(){}'
|
||||
})
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.contains` iterating an array')
|
||||
.add(buildName, '\
|
||||
@@ -595,6 +615,18 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.defaults`')
|
||||
.add(buildName, '\
|
||||
lodash.defaults({ "key2": 2, "key6": 6, "key18": 18 }, object)'
|
||||
)
|
||||
.add(otherName, '\
|
||||
_.defaults({ "key2": 2, "key6": 6, "key18": 18 }, object)'
|
||||
)
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.difference`')
|
||||
.add(buildName, '\
|
||||
@@ -723,6 +755,18 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.extend`')
|
||||
.add(buildName, '\
|
||||
lodash.extend({}, object)'
|
||||
)
|
||||
.add(otherName, '\
|
||||
_.extend({}, object)'
|
||||
)
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.filter` iterating an array')
|
||||
.add(buildName, '\
|
||||
|
||||
Reference in New Issue
Block a user