1 const Benchmark
= require('benny')
4 dynamicClusterTestFairShare
,
5 dynamicClusterTestLessUsed
,
6 dynamicClusterTestWeightedRoundRobin
,
7 dynamicClusterTestLessBusy
8 } = require('./cluster/dynamic')
11 fixedClusterTasksQueueTest
,
12 fixedClusterTestFairShare
,
13 fixedClusterTestLessUsed
,
14 fixedClusterTestWeightedRoundRobin
,
15 fixedClusterTestLessBusy
16 } = require('./cluster/fixed')
19 dynamicThreadTestFairShare
,
20 dynamicThreadTestLessUsed
,
21 dynamicThreadTestWeightedRoundRobin
,
22 dynamicThreadTestLessBusy
23 } = require('./thread/dynamic')
26 fixedThreadTasksQueueTest
,
27 fixedThreadTestFairShare
,
28 fixedThreadTestLessUsed
,
29 fixedThreadTestWeightedRoundRobin
,
30 fixedThreadTestLessBusy
31 } = require('./thread/fixed')
33 const resultsFile
= 'poolifier'
34 const resultsFolder
= 'benchmarks/internal/results'
38 Benchmark
.add('Poolifier:Fixed:ThreadPool', async () => {
39 await
fixedThreadTest()
41 Benchmark
.add('Poolifier:Fixed:ThreadPoolTasksQueue', async () => {
42 await
fixedThreadTasksQueueTest()
44 Benchmark
.add('Poolifier:Fixed:ThreadPool:LessUsed', async () => {
45 await
fixedThreadTestLessUsed()
47 Benchmark
.add('Poolifier:Fixed:ThreadPool:LessBusy', async () => {
48 await
fixedThreadTestLessBusy()
50 Benchmark
.add('Poolifier:Fixed:ThreadPool:WeightedRoundRobin', async () => {
51 await
fixedThreadTestWeightedRoundRobin()
53 Benchmark
.add('Poolifier:Fixed:ThreadPool:FairShare', async () => {
54 await
fixedThreadTestFairShare()
56 Benchmark
.add('Poolifier:Dynamic:ThreadPool', async () => {
57 await
dynamicThreadTest()
59 Benchmark
.add('Poolifier:Dynamic:ThreadPool:LessUsed', async () => {
60 await
dynamicThreadTestLessUsed()
62 Benchmark
.add('Poolifier:Dynamic:ThreadPool:LessBusy', async () => {
63 await
dynamicThreadTestLessBusy()
65 Benchmark
.add('Poolifier:Dynamic:ThreadPool:WeightedRoundRobin', async () => {
66 await
dynamicThreadTestWeightedRoundRobin()
68 Benchmark
.add('Poolifier:Dynamic:ThreadPool:FairShare', async () => {
69 await
dynamicThreadTestFairShare()
71 Benchmark
.add('Poolifier:Fixed:ClusterPool', async () => {
72 await
fixedClusterTest()
74 Benchmark
.add('Poolifier:Fixed:ClusterPoolTasksQueue', async () => {
75 await
fixedClusterTasksQueueTest()
77 Benchmark
.add('Poolifier:Fixed:ClusterPool:LessUsed', async () => {
78 await
fixedClusterTestLessUsed()
80 Benchmark
.add('Poolifier:Fixed:ClusterPool:LessBusy', async () => {
81 await
fixedClusterTestLessBusy()
83 Benchmark
.add('Poolifier:Fixed:ClusterPool:WeightedRoundRobin', async () => {
84 await
fixedClusterTestWeightedRoundRobin()
86 Benchmark
.add('Poolifier:Fixed:ClusterPool:FairShare', async () => {
87 await
fixedClusterTestFairShare()
89 Benchmark
.add('Poolifier:Dynamic:ClusterPool', async () => {
90 await
dynamicClusterTest()
92 Benchmark
.add('Poolifier:Dynamic:ClusterPool:LessUsed', async () => {
93 await
dynamicClusterTestLessUsed()
95 Benchmark
.add('Poolifier:Dynamic:ClusterPool:LessBusy', async () => {
96 await
dynamicClusterTestLessBusy()
99 'Poolifier:Dynamic:ClusterPool:WeightedRoundRobin',
101 await
dynamicClusterTestWeightedRoundRobin()
104 Benchmark
.add('Poolifier:Dynamic:ClusterPool:FairShare', async () => {
105 await
dynamicClusterTestFairShare()
108 Benchmark
.complete(),
111 folder
: resultsFolder
,
117 folder
: resultsFolder
,
118 format
: 'chart.html',
123 folder
: resultsFolder
,
124 format
: 'table.html',
129 // eslint-disable-next-line n/no-process-exit
130 return process
.exit()
132 .catch(err
=> console
.error(err
))