Update curry benchmark
This commit is contained in:
parent
9b1b6bb44a
commit
e99d575972
@ -3,12 +3,15 @@ const Benchmark = require('benchmark');
|
||||
|
||||
const u = require('../lib');
|
||||
const _ = require('lodash');
|
||||
const { curry4 } = require('../lib/util/curry');
|
||||
const { curry2, curry4 } = require('../lib/util/curry');
|
||||
|
||||
const add = (a, b, c, d) => a + b + c + d;
|
||||
const add4 = (a, b, c, d) => a + b + c + d;
|
||||
const add2 = (a, b) => a + b;
|
||||
const fakeCurryAdd = x => y => x + y;
|
||||
const curryAdd = _.curry(add);
|
||||
const updeepCurry = curry4(add);
|
||||
const lodashCurryAdd2 = _.curry(add2);
|
||||
const updeepCurryAdd2 = curry2(add2);
|
||||
const lodashCurryAdd4 = _.curry(add4);
|
||||
const updeepCurryAdd4 = curry4(add4);
|
||||
// const updeepCurryBig = curry.curryBig(add);
|
||||
|
||||
const array = [0, 1, 2, 3, 4, 5];
|
||||
@ -44,8 +47,20 @@ function createSuite(suiteName, tests) {
|
||||
|
||||
|
||||
const curryVsLodash = createSuite('Curry', {
|
||||
'updeep curry partial call': () => updeepCurry(3)(4)(5)(6),
|
||||
'lodash curry partial call': () => curryAdd(3)(4)(5)(6),
|
||||
'updeep curry': () => {
|
||||
updeepCurryAdd4(3)(4)(5)(6);
|
||||
updeepCurryAdd4(3, 4, 5, 6);
|
||||
updeepCurryAdd4(u._, 4, u._, 6)(3, 4);
|
||||
updeepCurryAdd2(3)(4);
|
||||
updeepCurryAdd2(3, 4);
|
||||
},
|
||||
'lodash curry': () => {
|
||||
lodashCurryAdd4(3)(4)(5)(6);
|
||||
lodashCurryAdd4(3, 4, 5, 6);
|
||||
lodashCurryAdd4(_, 4, _, 6)(3, 4);
|
||||
lodashCurryAdd2(3)(4);
|
||||
lodashCurryAdd2(3, 4);
|
||||
},
|
||||
});
|
||||
|
||||
const mapVsLodash = createSuite('Map', {
|
||||
|
Loading…
Reference in New Issue
Block a user