4 } = require('../../../lib/index')
5 const { runPoolifierTest
} = require('../../benchmarks-utils')
8 const numberOfTasks
= 1
10 const fixedPool
= new FixedThreadPool(
12 './benchmarks/internal/thread/worker.js'
15 const fixedPoolTasksQueue
= new FixedThreadPool(
17 './benchmarks/internal/thread/worker.js',
18 { enableTasksQueue
: true }
21 const fixedPoolLessUsed
= new FixedThreadPool(
23 './benchmarks/internal/thread/worker.js',
24 { workerChoiceStrategy
: WorkerChoiceStrategies
.LESS_USED
}
27 const fixedPoolLessBusy
= new FixedThreadPool(
29 './benchmarks/internal/thread/worker.js',
30 { workerChoiceStrategy
: WorkerChoiceStrategies
.LESS_BUSY
}
33 const fixedPoolWeightedRoundRobin
= new FixedThreadPool(
35 './benchmarks/internal/thread/worker.js',
36 { workerChoiceStrategy
: WorkerChoiceStrategies
.WEIGHTED_ROUND_ROBIN
}
39 const fixedPoolFairShare
= new FixedThreadPool(
41 './benchmarks/internal/thread/worker.js',
42 { workerChoiceStrategy
: WorkerChoiceStrategies
.FAIR_SHARE
}
45 async
function fixedThreadTest (
46 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
48 return runPoolifierTest(fixedPool
, { tasks
, workerData
})
51 async
function fixedThreadTasksQueueTest (
52 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
54 return runPoolifierTest(fixedPoolTasksQueue
, { tasks
, workerData
})
57 async
function fixedThreadTestLessUsed (
58 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
60 return runPoolifierTest(fixedPoolLessUsed
, { tasks
, workerData
})
63 async
function fixedThreadTestLessBusy (
64 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
66 return runPoolifierTest(fixedPoolLessBusy
, { tasks
, workerData
})
69 async
function fixedThreadTestWeightedRoundRobin (
70 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
72 return runPoolifierTest(fixedPoolWeightedRoundRobin
, { tasks
, workerData
})
75 async
function fixedThreadTestFairShare (
76 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
78 return runPoolifierTest(fixedPoolFairShare
, { tasks
, workerData
})
83 fixedThreadTasksQueueTest
,
84 fixedThreadTestLessUsed
,
85 fixedThreadTestLessBusy
,
86 fixedThreadTestWeightedRoundRobin
,
87 fixedThreadTestFairShare