mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Add _.partial perf tests.
This commit is contained in:
62
perf/perf.js
62
perf/perf.js
@@ -280,8 +280,7 @@
|
||||
}\
|
||||
\
|
||||
if (typeof bind != "undefined") {\
|
||||
var thisArg = { "name": "fred" },\
|
||||
ctor = function() {};\
|
||||
var thisArg = { "name": "fred" };\
|
||||
\
|
||||
var func = function(greeting, punctuation) {\
|
||||
return greeting + " " + this.name + (punctuation || ".");\
|
||||
@@ -483,6 +482,15 @@
|
||||
}\
|
||||
}\
|
||||
\
|
||||
if (typeof partial != "undefined") {\
|
||||
var func = function(greeting, punctuation) {\
|
||||
return greeting + " fred" + (punctuation || ".");\
|
||||
};\
|
||||
\
|
||||
var _partial = _.partial(func, "hi"),\
|
||||
lodashPartial = lodash.partial(func, "hi");\
|
||||
}\
|
||||
\
|
||||
if (typeof template != "undefined") {\
|
||||
var tplData = {\
|
||||
"header1": "Header1",\
|
||||
@@ -615,18 +623,6 @@
|
||||
})
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('bound call')
|
||||
.add(buildName, {
|
||||
'fn': 'lodashBoundNormal()',
|
||||
'teardown': 'function bind(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_boundNormal()',
|
||||
'teardown': 'function bind(){}'
|
||||
})
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('bound call with arguments')
|
||||
.add(buildName, {
|
||||
@@ -639,18 +635,6 @@
|
||||
})
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('bound and partially applied call')
|
||||
.add(buildName, {
|
||||
'fn': 'lodashBoundPartial()',
|
||||
'teardown': 'function bind(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_boundPartial()',
|
||||
'teardown': 'function bind(){}'
|
||||
})
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('bound and partially applied call with arguments')
|
||||
.add(buildName, {
|
||||
@@ -1477,6 +1461,32 @@
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
suites.length = 0;
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.partial`')
|
||||
.add(buildName, {
|
||||
'fn': 'lodash.partial(func, "hi")',
|
||||
'teardown': 'function partial(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_.partial(func, "hi")',
|
||||
'teardown': 'function partial(){}'
|
||||
})
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('partially applied call with arguments')
|
||||
.add(buildName, {
|
||||
'fn': 'lodashPartial("!")',
|
||||
'teardown': 'function partial(){}'
|
||||
})
|
||||
.add(otherName, {
|
||||
'fn': '_partial("!")',
|
||||
'teardown': 'function partial(){}'
|
||||
})
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('`_.pick`')
|
||||
|
||||
Reference in New Issue
Block a user