build(deps-dev): apply updates
[poolifier.git] / benchmarks / internal / bench.js
1 const Benchmark = require('benny')
2 const {
3 dynamicClusterTest,
4 dynamicClusterTestFairShare,
5 dynamicClusterTestLessUsed,
6 dynamicClusterTestWeightedRoundRobin,
7 dynamicClusterTestLessBusy
8 } = require('./cluster/dynamic')
9 const {
10 fixedClusterTest,
11 fixedClusterTasksQueueTest,
12 fixedClusterTestFairShare,
13 fixedClusterTestLessUsed,
14 fixedClusterTestWeightedRoundRobin,
15 fixedClusterTestLessBusy
16 } = require('./cluster/fixed')
17 const {
18 dynamicThreadTest,
19 dynamicThreadTestFairShare,
20 dynamicThreadTestLessUsed,
21 dynamicThreadTestWeightedRoundRobin,
22 dynamicThreadTestLessBusy
23 } = require('./thread/dynamic')
24 const {
25 fixedThreadTest,
26 fixedThreadTasksQueueTest,
27 fixedThreadTestFairShare,
28 fixedThreadTestLessUsed,
29 fixedThreadTestWeightedRoundRobin,
30 fixedThreadTestLessBusy
31 } = require('./thread/fixed')
32
33 const resultsFile = 'poolifier'
34 const resultsFolder = 'benchmarks/internal/results'
35
36 Benchmark.suite(
37 'Poolifier',
38 Benchmark.add('Poolifier:Fixed:ThreadPool', async () => {
39 await fixedThreadTest()
40 }),
41 Benchmark.add('Poolifier:Fixed:ThreadPoolTasksQueue', async () => {
42 await fixedThreadTasksQueueTest()
43 }),
44 Benchmark.add('Poolifier:Fixed:ThreadPool:LessUsed', async () => {
45 await fixedThreadTestLessUsed()
46 }),
47 Benchmark.add('Poolifier:Fixed:ThreadPool:LessBusy', async () => {
48 await fixedThreadTestLessBusy()
49 }),
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 }),
59 Benchmark.add('Poolifier:Dynamic:ThreadPool:LessUsed', async () => {
60 await dynamicThreadTestLessUsed()
61 }),
62 Benchmark.add('Poolifier:Dynamic:ThreadPool:LessBusy', async () => {
63 await dynamicThreadTestLessBusy()
64 }),
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 }),
74 Benchmark.add('Poolifier:Fixed:ClusterPoolTasksQueue', async () => {
75 await fixedClusterTasksQueueTest()
76 }),
77 Benchmark.add('Poolifier:Fixed:ClusterPool:LessUsed', async () => {
78 await fixedClusterTestLessUsed()
79 }),
80 Benchmark.add('Poolifier:Fixed:ClusterPool:LessBusy', async () => {
81 await fixedClusterTestLessBusy()
82 }),
83 Benchmark.add('Poolifier:Fixed:ClusterPool:WeightedRoundRobin', async () => {
84 await fixedClusterTestWeightedRoundRobin()
85 }),
86 Benchmark.add('Poolifier:Fixed:ClusterPool:FairShare', async () => {
87 await fixedClusterTestFairShare()
88 }),
89 Benchmark.add('Poolifier:Dynamic:ClusterPool', async () => {
90 await dynamicClusterTest()
91 }),
92 Benchmark.add('Poolifier:Dynamic:ClusterPool:LessUsed', async () => {
93 await dynamicClusterTestLessUsed()
94 }),
95 Benchmark.add('Poolifier:Dynamic:ClusterPool:LessBusy', async () => {
96 await dynamicClusterTestLessBusy()
97 }),
98 Benchmark.add(
99 'Poolifier:Dynamic:ClusterPool:WeightedRoundRobin',
100 async () => {
101 await dynamicClusterTestWeightedRoundRobin()
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 )
128 .then(() => {
129 // eslint-disable-next-line n/no-process-exit
130 return process.exit()
131 })
132 .catch(err => console.error(err))