forked from dcastil/tailwind-merge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmark.bench.ts
44 lines (41 loc) · 1.19 KB
/
benchmark.bench.ts
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
import { benchmarkSuite } from 'jest-bench'
import { createTailwindMerge, createTailwindMerge2 } from '../src'
const tailwindMerge = createTailwindMerge(() => ({
cacheSize: 20,
separator: ':',
theme: {},
classGroups: {
fooKey: [{ fooKey: ['bar', 'baz'] }],
fooKey2: [{ fooKey: ['qux', 'quux'] }, 'other-2'],
otherKey: ['nother', 'group'],
},
conflictingClassGroups: {
fooKey: ['otherKey'],
otherKey: ['fooKey', 'fooKey2'],
},
conflictingClassGroupModifiers: {},
}))
const tailwindMerge2 = createTailwindMerge2(() => ({
cacheSize: 20,
separator: ':',
theme: {},
classGroups: {
fooKey: [{ fooKey: ['bar', 'baz'] }],
fooKey2: [{ fooKey: ['qux', 'quux'] }, 'other-2'],
otherKey: ['nother', 'group'],
},
conflictingClassGroups: {
fooKey: ['otherKey'],
otherKey: ['fooKey', 'fooKey2'],
},
conflictingClassGroupModifiers: {},
}))
benchmarkSuite('createTailwindMerge', {
setup() {},
'v1': () => {
tailwindMerge('my-modifier:fooKey-bar my-modifier:fooKey-baz')
},
'v2': () => {
tailwindMerge2('my-modifier:fooKey-bar my-modifier:fooKey-baz')
},
})