import { StaticPool } from 'node-worker-threads-pool'
// FINISH IMPORT LIBRARIES
// IMPORT FUNCTION TO BENCH
-import functionToBench from './functions/function-to-bench.mjs'
+import functionToBench from './functions/function-to-bench.js'
// FINISH IMPORT FUNCTION TO BENCH
const size = parseInt(process.env.POOL_SIZE)
const iterations = parseInt(process.env.NUM_ITERATIONS)
})
async function run () {
- const promises = []
+ const promises = new Set()
for (let i = 0; i < iterations; i++) {
- promises.push(pool.exec(data))
+ promises.add(pool.exec(data))
}
await Promise.all(promises)
// eslint-disable-next-line n/no-process-exit