Bump to beta 7 version
[poolifier.git] / benchmarks / versus-external-pools / fixed-poolifier.js
CommitLineData
be0676b3
APA
1// IMPORT LIBRARIES
2const { FixedThreadPool, DynamicThreadPool } = require('poolifier')
3// FINISH IMPORT LIBRARIES
4const size = process.env.POOL_SIZE
5const iterations = process.env.NUM_ITERATIONS
6const data = {
7 test: 'MYBENCH'
8}
9
10const fixedPool = new FixedThreadPool(
11 size,
12 './workers/poolifier/json-stringify.worker.js',
13 {
14 maxTasks: 100000
15 }
16)
17
18async function run () {
19 const promises = []
20 for (let i = 0; i < iterations; i++) {
21 promises.push(fixedPool.execute(data))
22 }
23 await Promise.all(promises)
24 process.exit()
25}
26
27run()