mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Add _.difference, _.pick, and _.union benchmarks.
Former-commit-id: 1dd1e577520dfc1a69876eeccadce871f1f05916
This commit is contained in:
39
perf/perf.js
39
perf/perf.js
@@ -165,7 +165,19 @@
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('groupBy with callback')
|
||||
Benchmark.Suite('difference')
|
||||
.add('Lo-Dash', function() {
|
||||
lodash.difference(numbers, [5, 25, 10, 30]);
|
||||
})
|
||||
.add('Underscore', function() {
|
||||
_.difference(numbers, [5, 25, 10, 30]);
|
||||
})
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('groupBy callback')
|
||||
.add('Lo-Dash', function() {
|
||||
lodash.groupBy(numbers, function(num) { return Math.floor(num); });
|
||||
})
|
||||
@@ -175,7 +187,7 @@
|
||||
);
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('groupBy with property name')
|
||||
Benchmark.Suite('groupBy property name')
|
||||
.add('Lo-Dash', function() {
|
||||
lodash.groupBy(words, 'length');
|
||||
})
|
||||
@@ -211,6 +223,17 @@
|
||||
});
|
||||
})
|
||||
);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('pick')
|
||||
.add('Lo-Dash', function() {
|
||||
lodash.pick(object, 'key6', 'key13');
|
||||
})
|
||||
.add('Underscore', function() {
|
||||
_.pick(object, 'key6', 'key13');
|
||||
})
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
@@ -226,6 +249,18 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('union')
|
||||
.add('Lo-Dash', function() {
|
||||
lodash.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
||||
})
|
||||
.add('Underscore', function() {
|
||||
_.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
||||
})
|
||||
);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
suites.push(
|
||||
Benchmark.Suite('values')
|
||||
.add('Lo-Dash', function() {
|
||||
|
||||
Reference in New Issue
Block a user