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