1 const Benchmark
= require('benny')
4 dynamicClusterTestFairShare
,
5 dynamicClusterTestLessUsed
,
6 dynamicClusterTestWeightedRoundRobin
,
7 dynamicClusterTestLessBusy
8 } = require('./cluster/dynamic')
11 fixedClusterTestFairShare
,
12 fixedClusterTestLessUsed
,
13 fixedClusterTestWeightedRoundRobin
,
14 fixedClusterTestLessBusy
15 } = require('./cluster/fixed')
18 dynamicThreadTestFairShare
,
19 dynamicThreadTestLessUsed
,
20 dynamicThreadTestWeightedRoundRobin
,
21 dynamicThreadTestLessBusy
22 } = require('./thread/dynamic')
25 fixedThreadTestFairShare
,
26 fixedThreadTestLessUsed
,
27 fixedThreadTestWeightedRoundRobin
,
28 fixedThreadTestLessBusy
29 } = require('./thread/fixed')
31 const resultsFile
= 'poolifier'
32 const resultsFolder
= 'benchmarks/internal/results'
36 Benchmark
.add('Poolifier:Fixed:ThreadPool', async () => {
37 await
fixedThreadTest()
39 Benchmark
.add('Poolifier:Fixed:ThreadPool:LessUsed', async () => {
40 await
fixedThreadTestLessUsed()
42 Benchmark
.add('Poolifier:Fixed:ThreadPool:LessBusy', async () => {
43 await
fixedThreadTestLessBusy()
45 Benchmark
.add('Poolifier:Fixed:ThreadPool:WeightedRoundRobin', async () => {
46 await
fixedThreadTestWeightedRoundRobin()
48 Benchmark
.add('Poolifier:Fixed:ThreadPool:FairShare', async () => {
49 await
fixedThreadTestFairShare()
51 Benchmark
.add('Poolifier:Dynamic:ThreadPool', async () => {
52 await
dynamicThreadTest()
54 Benchmark
.add('Poolifier:Dynamic:ThreadPool:LessUsed', async () => {
55 await
dynamicThreadTestLessUsed()
57 Benchmark
.add('Poolifier:Dynamic:ThreadPool:LessBusy', async () => {
58 await
dynamicThreadTestLessBusy()
60 Benchmark
.add('Poolifier:Dynamic:ThreadPool:WeightedRoundRobin', async () => {
61 await
dynamicThreadTestWeightedRoundRobin()
63 Benchmark
.add('Poolifier:Dynamic:ThreadPool:FairShare', async () => {
64 await
dynamicThreadTestFairShare()
66 Benchmark
.add('Poolifier:Fixed:ClusterPool', async () => {
67 await
fixedClusterTest()
69 Benchmark
.add('Poolifier:Fixed:ClusterPool:LessUsed', async () => {
70 await
fixedClusterTestLessUsed()
72 Benchmark
.add('Poolifier:Fixed:ClusterPool:LessBusy', async () => {
73 await
fixedClusterTestLessBusy()
75 Benchmark
.add('Poolifier:Fixed:ClusterPool:WeightedRoundRobin', async () => {
76 await
fixedClusterTestWeightedRoundRobin()
78 Benchmark
.add('Poolifier:Fixed:ClusterPool:FairShare', async () => {
79 await
fixedClusterTestFairShare()
81 Benchmark
.add('Poolifier:Dynamic:ClusterPool', async () => {
82 await
dynamicClusterTest()
84 Benchmark
.add('Poolifier:Dynamic:ClusterPool:LessUsed', async () => {
85 await
dynamicClusterTestLessUsed()
87 Benchmark
.add('Poolifier:Dynamic:ClusterPool:LessBusy', async () => {
88 await
dynamicClusterTestLessBusy()
91 'Poolifier:Dynamic:ClusterPool:WeightedRoundRobin',
93 await
dynamicClusterTestWeightedRoundRobin()
96 Benchmark
.add('Poolifier:Dynamic:ClusterPool:FairShare', async () => {
97 await
dynamicClusterTestFairShare()
100 Benchmark
.complete(),
103 folder
: resultsFolder
,
109 folder
: resultsFolder
,
110 format
: 'chart.html',
115 folder
: resultsFolder
,
116 format
: 'table.html',
121 // eslint-disable-next-line n/no-process-exit
122 return process
.exit()
124 .catch(err
=> console
.error(err
))