Apply dependencies update
[poolifier.git] / benchmarks / internal / bench.js
1 const Benchmark = require('benny')
2 const {
3 dynamicClusterTest,
4 dynamicClusterTestFairShare,
5 dynamicClusterTestLessRecentlyUsed,
6 dynamicClusterTestWeightedRoundRobin
7 } = require('./cluster/dynamic')
8 const {
9 fixedClusterTest,
10 fixedClusterTestFairShare,
11 fixedClusterTestLessRecentlyUsed,
12 fixedClusterTestWeightedRoundRobin
13 } = require('./cluster/fixed')
14 const {
15 dynamicThreadTest,
16 dynamicThreadTestFairShare,
17 dynamicThreadTestLessRecentlyUsed,
18 dynamicThreadTestWeightedRoundRobin
19 } = require('./thread/dynamic')
20 const {
21 fixedThreadTest,
22 fixedThreadTestFairShare,
23 fixedThreadTestLessRecentlyUsed,
24 fixedThreadTestWeightedRoundRobin
25 } = require('./thread/fixed')
26
27 const resultsFile = 'poolifier'
28 const resultsFolder = 'benchmarks/internal/results'
29
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 () => {
77 await dynamicClusterTestWeightedRoundRobin
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 )
104 .then(() => {
105 // eslint-disable-next-line n/no-process-exit
106 return process.exit()
107 })
108 .catch(err => console.error(err))