Update vendors and add _.reduce, _.reduceRight, and _.where benchmarks.

Former-commit-id: c1b4bc7f8aaf08c429ae918f5d528401f1a66255
This commit is contained in:
John-David Dalton
2012-09-19 21:40:39 -07:00
parent 25de44a23d
commit b91b04f652
5 changed files with 160 additions and 35 deletions

View File

@@ -1152,6 +1152,74 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.reduce` iterating an array')
.add('Lo-Dash', '\
lodash.reduce(numbers, function(result, value, index) {\
result[index] = value;\
return result;\
}, {});'
)
.add('Underscore', '\
_.reduce(numbers, function(result, value, index) {\
result[index] = value;\
return result;\
}, {});'
)
);
suites.push(
Benchmark.Suite('`_.reduce` iterating an object')
.add('Lo-Dash', '\
lodash.reduce(object, function(result, value, key) {\
result.push([key, value]);\
return result;\
}, []);'
)
.add('Underscore', '\
_.reduce(object, function(result, value, key) {\
result.push([key, value]);\
return result;\
}, []);'
)
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.reduceRight` iterating an array')
.add('Lo-Dash', '\
lodash.reduceRight(numbers, function(result, value, index) {\
result[index] = value;\
return result;\
}, {});'
)
.add('Underscore', '\
_.reduceRight(numbers, function(result, value, index) {\
result[index] = value;\
return result;\
}, {});'
)
);
suites.push(
Benchmark.Suite('`_.reduceRight` iterating an object')
.add('Lo-Dash', '\
lodash.reduceRight(object, function(result, value, key) {\
result.push([key, value]);\
return result;\
}, []);'
)
.add('Underscore', '\
_.reduceRight(object, function(result, value, key) {\
result.push([key, value]);\
return result;\
}, []);'
)
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.shuffle`')
.add('Lo-Dash', '\
@@ -1412,6 +1480,18 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.where`')
.add('Lo-Dash', '\
lodash.where(objects, { "num": 9 });'
)
.add('Underscore', '\
_.where(objects, { "num": 9 });'
)
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.without`')
.add('Lo-Dash', '\