Improve benchmarks: add IO intensive task workload, add task size option, integrate...
[poolifier.git] / benchmarks / versus-external-pools / fixed-threadwork.js
1 // IMPORT LIBRARIES
2 const threadPool = require('./pool-threadwork')
3 // FINISH IMPORT LIBRARIES
4 const iterations = Number(process.env.NUM_ITERATIONS)
5 const data = {
6 test: 'MYBENCH',
7 taskType: process.env.TASK_TYPE,
8 taskSize: process.env.TASK_SIZE
9 }
10
11 async function run () {
12 const promises = []
13 for (let i = 0; i < iterations; i++) {
14 promises.push(threadPool.run(data))
15 }
16 await Promise.all(promises)
17 // eslint-disable-next-line no-process-exit
18 process.exit()
19 }
20
21 run()