Add _.partial perf tests.

This commit is contained in:
John-David Dalton
2013-10-29 23:58:40 -07:00
parent 852b324819
commit 7d52ab7c54

View File

@@ -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`')