-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsuite.js
56 lines (47 loc) · 1.22 KB
/
suite.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
const { generateDraft, reducer } = require("./mock");
const { createStore: efStore, createEvent: efAction } = require("effector");
const { path } = require("pathon");
const MAX = 1000;
const MODIFY_FACTOR = 0.5;
// require("./frameworks/parket");
require("./frameworks/redux");
require("./frameworks/mst");
require("./frameworks/mobx");
suite("noop", function() {
bench("create", function() {
generateDraft();
});
const sta = generateDraft();
bench("modify", function() {
reducer(sta);
});
});
suite("pathon", function() {
bench("create", function() {
const pRoot = path("root", generateDraft());
pRoot.watch(() => {});
});
const pRoot = path("root", generateDraft());
pRoot.watch(() => {});
bench("modify", function() {
for (let i = 0; i < MAX * MODIFY_FACTOR; i++) {
pRoot
.path(i)
.path("done")
.set(Math.random());
}
});
});
suite("effector", function() {
bench("create", function() {
const toggle = efAction("");
const state = efStore(generateDraft());
state.on(toggle, (_, p) => p);
});
const toggle = efAction("");
const state = efStore(generateDraft());
state.on(toggle, reducer);
bench("modify", function() {
toggle();
});
});