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