Commit | Line | Data |
---|---|---|
ca6c7d70 | 1 | const Benchmark = require('benny') |
ff5e76e1 JB |
2 | const { |
3 | dynamicClusterTest, | |
23ff945a | 4 | dynamicClusterTestFairShare, |
168c526f | 5 | dynamicClusterTestLessUsed, |
d4abc60a JB |
6 | dynamicClusterTestWeightedRoundRobin, |
7 | dynamicClusterTestLessBusy | |
ff5e76e1 | 8 | } = require('./cluster/dynamic') |
292ad316 JB |
9 | const { |
10 | fixedClusterTest, | |
869b1a45 | 11 | fixedClusterTasksQueueTest, |
23ff945a | 12 | fixedClusterTestFairShare, |
168c526f | 13 | fixedClusterTestLessUsed, |
d4abc60a JB |
14 | fixedClusterTestWeightedRoundRobin, |
15 | fixedClusterTestLessBusy | |
292ad316 | 16 | } = require('./cluster/fixed') |
ff5e76e1 JB |
17 | const { |
18 | dynamicThreadTest, | |
23ff945a | 19 | dynamicThreadTestFairShare, |
168c526f | 20 | dynamicThreadTestLessUsed, |
d4abc60a JB |
21 | dynamicThreadTestWeightedRoundRobin, |
22 | dynamicThreadTestLessBusy | |
ff5e76e1 | 23 | } = require('./thread/dynamic') |
292ad316 JB |
24 | const { |
25 | fixedThreadTest, | |
869b1a45 | 26 | fixedThreadTasksQueueTest, |
23ff945a | 27 | fixedThreadTestFairShare, |
168c526f | 28 | fixedThreadTestLessUsed, |
d4abc60a JB |
29 | fixedThreadTestWeightedRoundRobin, |
30 | fixedThreadTestLessBusy | |
292ad316 | 31 | } = require('./thread/fixed') |
325f50bc | 32 | |
ca6c7d70 JB |
33 | const resultsFile = 'poolifier' |
34 | const resultsFolder = 'benchmarks/internal/results' | |
57df5469 | 35 | |
ca6c7d70 JB |
36 | Benchmark.suite( |
37 | 'Poolifier', | |
38 | Benchmark.add('Poolifier:Fixed:ThreadPool', async () => { | |
39 | await fixedThreadTest() | |
40 | }), | |
869b1a45 JB |
41 | Benchmark.add('Poolifier:Fixed:ThreadPoolTasksQueue', async () => { |
42 | await fixedThreadTasksQueueTest() | |
43 | }), | |
168c526f JB |
44 | Benchmark.add('Poolifier:Fixed:ThreadPool:LessUsed', async () => { |
45 | await fixedThreadTestLessUsed() | |
ca6c7d70 | 46 | }), |
d4abc60a JB |
47 | Benchmark.add('Poolifier:Fixed:ThreadPool:LessBusy', async () => { |
48 | await fixedThreadTestLessBusy() | |
49 | }), | |
ca6c7d70 JB |
50 | Benchmark.add('Poolifier:Fixed:ThreadPool:WeightedRoundRobin', async () => { |
51 | await fixedThreadTestWeightedRoundRobin() | |
52 | }), | |
53 | Benchmark.add('Poolifier:Fixed:ThreadPool:FairShare', async () => { | |
54 | await fixedThreadTestFairShare() | |
55 | }), | |
56 | Benchmark.add('Poolifier:Dynamic:ThreadPool', async () => { | |
57 | await dynamicThreadTest() | |
58 | }), | |
168c526f JB |
59 | Benchmark.add('Poolifier:Dynamic:ThreadPool:LessUsed', async () => { |
60 | await dynamicThreadTestLessUsed() | |
ca6c7d70 | 61 | }), |
d4abc60a JB |
62 | Benchmark.add('Poolifier:Dynamic:ThreadPool:LessBusy', async () => { |
63 | await dynamicThreadTestLessBusy() | |
64 | }), | |
ca6c7d70 JB |
65 | Benchmark.add('Poolifier:Dynamic:ThreadPool:WeightedRoundRobin', async () => { |
66 | await dynamicThreadTestWeightedRoundRobin() | |
67 | }), | |
68 | Benchmark.add('Poolifier:Dynamic:ThreadPool:FairShare', async () => { | |
69 | await dynamicThreadTestFairShare() | |
70 | }), | |
71 | Benchmark.add('Poolifier:Fixed:ClusterPool', async () => { | |
72 | await fixedClusterTest() | |
73 | }), | |
869b1a45 JB |
74 | Benchmark.add('Poolifier:Fixed:ClusterPoolTasksQueue', async () => { |
75 | await fixedClusterTasksQueueTest() | |
76 | }), | |
168c526f JB |
77 | Benchmark.add('Poolifier:Fixed:ClusterPool:LessUsed', async () => { |
78 | await fixedClusterTestLessUsed() | |
ca6c7d70 | 79 | }), |
d4abc60a JB |
80 | Benchmark.add('Poolifier:Fixed:ClusterPool:LessBusy', async () => { |
81 | await fixedClusterTestLessBusy() | |
82 | }), | |
ca6c7d70 | 83 | Benchmark.add('Poolifier:Fixed:ClusterPool:WeightedRoundRobin', async () => { |
d4abc60a | 84 | await fixedClusterTestWeightedRoundRobin() |
ca6c7d70 JB |
85 | }), |
86 | Benchmark.add('Poolifier:Fixed:ClusterPool:FairShare', async () => { | |
87 | await fixedClusterTestFairShare() | |
88 | }), | |
89 | Benchmark.add('Poolifier:Dynamic:ClusterPool', async () => { | |
90 | await dynamicClusterTest() | |
91 | }), | |
168c526f JB |
92 | Benchmark.add('Poolifier:Dynamic:ClusterPool:LessUsed', async () => { |
93 | await dynamicClusterTestLessUsed() | |
ca6c7d70 | 94 | }), |
d4abc60a JB |
95 | Benchmark.add('Poolifier:Dynamic:ClusterPool:LessBusy', async () => { |
96 | await dynamicClusterTestLessBusy() | |
97 | }), | |
ca6c7d70 JB |
98 | Benchmark.add( |
99 | 'Poolifier:Dynamic:ClusterPool:WeightedRoundRobin', | |
100 | async () => { | |
d4abc60a | 101 | await dynamicClusterTestWeightedRoundRobin() |
ca6c7d70 JB |
102 | } |
103 | ), | |
104 | Benchmark.add('Poolifier:Dynamic:ClusterPool:FairShare', async () => { | |
105 | await dynamicClusterTestFairShare() | |
106 | }), | |
107 | Benchmark.cycle(), | |
108 | Benchmark.complete(), | |
109 | Benchmark.save({ | |
110 | file: resultsFile, | |
111 | folder: resultsFolder, | |
112 | format: 'json', | |
113 | details: true | |
114 | }), | |
115 | Benchmark.save({ | |
116 | file: resultsFile, | |
117 | folder: resultsFolder, | |
118 | format: 'chart.html', | |
119 | details: true | |
120 | }), | |
121 | Benchmark.save({ | |
122 | file: resultsFile, | |
123 | folder: resultsFolder, | |
124 | format: 'table.html', | |
125 | details: true | |
126 | }) | |
127 | ) | |
18cac485 JB |
128 | .then(() => { |
129 | // eslint-disable-next-line n/no-process-exit | |
130 | return process.exit() | |
131 | }) | |
132 | .catch(err => console.error(err)) |