1 const Benchmark
= require('benny')
4 dynamicClusterTestFairShare
,
5 dynamicClusterTestLessRecentlyUsed
,
6 dynamicClusterTestWeightedRoundRobin
7 } = require('./cluster/dynamic')
10 fixedClusterTestFairShare
,
11 fixedClusterTestLessRecentlyUsed
,
12 fixedClusterTestWeightedRoundRobin
13 } = require('./cluster/fixed')
16 dynamicThreadTestFairShare
,
17 dynamicThreadTestLessRecentlyUsed
,
18 dynamicThreadTestWeightedRoundRobin
19 } = require('./thread/dynamic')
22 fixedThreadTestFairShare
,
23 fixedThreadTestLessRecentlyUsed
,
24 fixedThreadTestWeightedRoundRobin
25 } = require('./thread/fixed')
27 const resultsFile
= 'poolifier'
28 const resultsFolder
= 'benchmarks/internal/results'
32 Benchmark
.add('Poolifier:Fixed:ThreadPool', async () => {
33 await
fixedThreadTest()
35 Benchmark
.add('Poolifier:Fixed:ThreadPool:LessRecentlyUsed', async () => {
36 await
fixedThreadTestLessRecentlyUsed()
38 Benchmark
.add('Poolifier:Fixed:ThreadPool:WeightedRoundRobin', async () => {
39 await
fixedThreadTestWeightedRoundRobin()
41 Benchmark
.add('Poolifier:Fixed:ThreadPool:FairShare', async () => {
42 await
fixedThreadTestFairShare()
44 Benchmark
.add('Poolifier:Dynamic:ThreadPool', async () => {
45 await
dynamicThreadTest()
47 Benchmark
.add('Poolifier:Dynamic:ThreadPool:LessRecentlyUsed', async () => {
48 await
dynamicThreadTestLessRecentlyUsed()
50 Benchmark
.add('Poolifier:Dynamic:ThreadPool:WeightedRoundRobin', async () => {
51 await
dynamicThreadTestWeightedRoundRobin()
53 Benchmark
.add('Poolifier:Dynamic:ThreadPool:FairShare', async () => {
54 await
dynamicThreadTestFairShare()
56 Benchmark
.add('Poolifier:Fixed:ClusterPool', async () => {
57 await
fixedClusterTest()
59 Benchmark
.add('Poolifier:Fixed:ClusterPool:LessRecentlyUsed', async () => {
60 await
fixedClusterTestLessRecentlyUsed()
62 Benchmark
.add('Poolifier:Fixed:ClusterPool:WeightedRoundRobin', async () => {
63 await fixedClusterTestWeightedRoundRobin
65 Benchmark
.add('Poolifier:Fixed:ClusterPool:FairShare', async () => {
66 await
fixedClusterTestFairShare()
68 Benchmark
.add('Poolifier:Dynamic:ClusterPool', async () => {
69 await
dynamicClusterTest()
71 Benchmark
.add('Poolifier:Dynamic:ClusterPool:LessRecentlyUsed', async () => {
72 await
dynamicClusterTestLessRecentlyUsed()
75 'Poolifier:Dynamic:ClusterPool:WeightedRoundRobin',
77 await dynamicClusterTestWeightedRoundRobin
80 Benchmark
.add('Poolifier:Dynamic:ClusterPool:FairShare', async () => {
81 await
dynamicClusterTestFairShare()
87 folder
: resultsFolder
,
93 folder
: resultsFolder
,
99 folder
: resultsFolder
,
100 format
: 'table.html',
105 // eslint-disable-next-line n/no-process-exit
106 return process
.exit()
108 .catch(err
=> console
.error(err
))