-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
bench.js
71 lines (60 loc) · 1.09 KB
/
bench.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
'use strict';
/* globals bench suite */
var lodash = require('lodash');
var objectAssign = require('./');
var source1 = {
a: 1,
b: 2,
c: 3
};
var source2 = {
c: 3,
d: 4,
e: 5,
f: 6,
g: 7,
h: 8,
i: 9,
j: 10,
k: 11,
l: 12,
m: 13,
n: 15,
o: 15,
p: 16
};
if (Object.assign) {
suite('Object.assign', function () {
bench('small', function () {
Object.assign({foo: 0}, {bar: 1});
});
bench('default options', function () {
Object.assign({}, {foo: 0}, {foo: 1});
});
bench('big', function () {
Object.assign({}, source1, source2);
});
});
}
suite('object-assign', function () {
bench('small', function () {
objectAssign({foo: 0}, {bar: 1});
});
bench('default options', function () {
objectAssign({}, {foo: 0}, {foo: 1});
});
bench('big', function () {
objectAssign({}, source1, source2);
});
});
suite('lodash', function () {
bench('small', function () {
lodash.assign({foo: 0}, {bar: 1});
});
bench('default options', function () {
lodash.assign({}, {foo: 0}, {foo: 1});
});
bench('big', function () {
lodash.assign({}, source1, source2);
});
});