2 const { DynamicPool
, StaticPool
} = require('node-worker-threads-pool')
3 // FINISH IMPORT LIBRARIES
4 // IMPORT FUNCTION TO BENCH
5 const functionToBench
= require('./functions/json-stringify')
6 // FINISH IMPORT FUNCTION TO BENCH
7 const size
= process
.env
.POOL_SIZE
8 const iterations
= process
.env
.NUM_ITERATIONS
13 const pool
= new StaticPool({
18 async
function run () {
20 for (let i
= 0; i
< iterations
; i
++) {
21 promises
.push(pool
.exec(data
))
23 await Promise
.all(promises
)