-
Notifications
You must be signed in to change notification settings - Fork 0
/
benchmark.js
58 lines (55 loc) · 1.17 KB
/
benchmark.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
import Benchmark from 'benchmark';
import toStyle from './src/index.js';
const suite = new Benchmark.Suite();
const sideEffectsObj = {};
const basic = { opacity: 1 };
const matrix = { x: 1, y: 1500.089 };
const normal = { top: 0.001, left: 20.851, opacity: 1.05 };
const large = {
content: '',
display: 'block',
backgroundSize: 'cover',
backgroundRepeat: 'no-repeat',
backgroundImage: 'url(https://placehold.it/500x500?text=test)',
backfaceVisibility: 'hidden',
transition: 'all 300ms ease',
opacity: 1.05,
top: 0.001,
left: 20.851,
margin: [1, 1, 1, 1],
padding: [1, 1, 1, 1],
x: 1,
y: 1500.089,
z: 20,
rotateX: 2,
rotateY: 2,
rotateZ: 2,
skewX: 10,
skewY: 10,
scaleX: 0,
scaleY: 1,
scaleZ: 0.5,
};
suite
.add('basic', function() {
toStyle(basic);
})
.add('matrix', function() {
toStyle(matrix);
})
.add('no-side-effects', function() {
toStyle(normal);
})
.add('side-effects', function() {
toStyle(normal, sideEffectsObj);
})
.add('no-side-effects#large', function() {
toStyle(large);
})
.add('side-effects#large', function() {
toStyle(large, sideEffectsObj);
})
.on('cycle', function(event) {
console.log(String(event.target));
})
.run();