Benchmarks: properly parse env variables
[poolifier.git] / benchmarks / versus-external-pools / fixed-poolifier.js
index b62cd5934424a0fb9dc3422011ba98242ae717be..2a5e599ab11aefc0948bb8ec208f3650ede4e02f 100644 (file)
@@ -1,18 +1,17 @@
 // IMPORT LIBRARIES
-const { FixedThreadPool, DynamicThreadPool } = require('poolifier')
+const { FixedThreadPool } = require('poolifier')
 // FINISH IMPORT LIBRARIES
-const size = process.env.POOL_SIZE
-const iterations = process.env.NUM_ITERATIONS
+const size = parseInt(process.env.POOL_SIZE)
+const iterations = parseInt(process.env.NUM_ITERATIONS)
 const data = {
-  test: 'MYBENCH'
+  test: 'MYBENCH',
+  taskType: process.env.TASK_TYPE,
+  taskSize: parseInt(process.env.TASK_SIZE)
 }
 
 const fixedPool = new FixedThreadPool(
   size,
-  './workers/poolifier/json-stringify.worker.js',
-  {
-    maxTasks: 100000
-  }
+  './workers/poolifier/function-to-bench-worker.js'
 )
 
 async function run () {
@@ -21,6 +20,7 @@ async function run () {
     promises.push(fixedPool.execute(data))
   }
   await Promise.all(promises)
+  // eslint-disable-next-line n/no-process-exit
   process.exit()
 }