X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Fversus-external-pools%2Fdynamic-piscina.mjs;h=3f56a69907bc31dadc0db60bec85d43aa1ca2878;hb=2c93d3cf3183abd425f1578b66fc3b38fae85349;hp=a1e425f8e95f3a19c8cc5d776cb225fd11f9b200;hpb=02749105fad5c3de792acbe23ed8dae1915ba2aa;p=poolifier.git diff --git a/benchmarks/versus-external-pools/dynamic-piscina.mjs b/benchmarks/versus-external-pools/dynamic-piscina.mjs index a1e425f8..3f56a699 100644 --- a/benchmarks/versus-external-pools/dynamic-piscina.mjs +++ b/benchmarks/versus-external-pools/dynamic-piscina.mjs @@ -1,6 +1,6 @@ -// IMPORT LIBRARIES import Piscina from 'piscina' -// FINISH IMPORT LIBRARIES +import { executeAsyncFn } from '../benchmarks-utils.mjs' + const size = parseInt(process.env.POOL_SIZE) const iterations = parseInt(process.env.NUM_ITERATIONS) const data = { @@ -17,13 +17,13 @@ const piscina = new Piscina({ }) async function run () { - const promises = [] + const promises = new Set() for (let i = 0; i < iterations; i++) { - promises.push(piscina.run(data)) + promises.add(piscina.run(data)) } await Promise.all(promises) // eslint-disable-next-line n/no-process-exit process.exit() } -await run() +await executeAsyncFn(run)