docs: update benchmark versus external pools results
[poolifier.git] / benchmarks / versus-external-pools / fixed-poolifier.mjs
index 9a84e1e64a09293c0055d25b131fd30e7d323741..5efd786e562d1d6acabe2ad2981ccd2754fbe42e 100644 (file)
@@ -1,6 +1,6 @@
-// IMPORT LIBRARIES
 import { FixedThreadPool } from 'poolifier'
-// FINISH IMPORT LIBRARIES
+import { executeAsyncFn } from './utils.mjs'
+
 const size = parseInt(process.env.POOL_SIZE)
 const iterations = parseInt(process.env.NUM_ITERATIONS)
 const data = {
@@ -9,7 +9,7 @@ const data = {
   taskSize: parseInt(process.env.TASK_SIZE)
 }
 
-const fixedPool = new FixedThreadPool(
+const fixedThreadPool = new FixedThreadPool(
   size,
   './workers/poolifier/function-to-bench-worker.mjs',
   {
@@ -20,11 +20,11 @@ const fixedPool = new FixedThreadPool(
 async function run () {
   const promises = new Set()
   for (let i = 0; i < iterations; i++) {
-    promises.add(fixedPool.execute(data))
+    promises.add(fixedThreadPool.execute(data))
   }
   await Promise.all(promises)
   // eslint-disable-next-line n/no-process-exit
   process.exit()
 }
 
-await run()
+await executeAsyncFn(run)