X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmarks%2Fversus-external-pools%2Ffixed-threadwork.js;h=d21fae6a8e2179704af88fb420c40f2c338deb1a;hb=ed6dd37f9e137cf659523d9d792f0171eedcb8ed;hp=fcc370ff1922f1a06b2f9b05e300872f67bc405e;hpb=79e7d3680bb510d4c5419701de6638fb19816c2c;p=poolifier.git diff --git a/benchmarks/versus-external-pools/fixed-threadwork.js b/benchmarks/versus-external-pools/fixed-threadwork.js index fcc370ff..d21fae6a 100644 --- a/benchmarks/versus-external-pools/fixed-threadwork.js +++ b/benchmarks/versus-external-pools/fixed-threadwork.js @@ -1,24 +1,20 @@ // IMPORT LIBRARIES -const { ThreadPool } = require('threadwork') +const threadPool = require('./pool-threadwork') // FINISH IMPORT LIBRARIES -// IMPORT FUNCTION TO BENCH -const functionToBench = require('./functions/function-to-bench') -// FINISH IMPORT FUNCTION TO BENCH -const size = Number(process.env.POOL_SIZE) -const iterations = Number(process.env.NUM_ITERATIONS) +const iterations = parseInt(process.env.NUM_ITERATIONS) const data = { test: 'MYBENCH', - taskType: process.env['TASK_TYPE'] + taskType: process.env.TASK_TYPE, + taskSize: parseInt(process.env.TASK_SIZE) } -const threadPool = new ThreadPool({ task: functionToBench, size: size }) - async function run () { const promises = [] for (let i = 0; i < iterations; i++) { promises.push(threadPool.run(data)) } await Promise.all(promises) + // eslint-disable-next-line n/no-process-exit process.exit() }