mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Update vendors and add _.reduce, _.reduceRight, and _.where benchmarks.
Former-commit-id: c1b4bc7f8aaf08c429ae918f5d528401f1a66255
This commit is contained in:
80
perf/perf.js
80
perf/perf.js
@@ -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', '\
|
||||
|
||||
Reference in New Issue
Block a user