perf: cleanup benchmark
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 13 May 2024 20:00:59 +0000 (22:00 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 13 May 2024 20:00:59 +0000 (22:00 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
benchmarks/benchmarks-utils.mjs

index 8620dd681b10be4b6019dfc3d2be0dcfcf770311..16a656107fc6f00973fe7bdc6541a6bab2794a2b 100644 (file)
@@ -54,24 +54,9 @@ const buildPoolifierPool = (workerType, poolType, poolSize, poolOptions) => {
 }
 
 const runPoolifierPool = async (pool, { taskExecutions, workerData }) => {
-  return await new Promise((resolve, reject) => {
-    let executions = 0
-    for (let i = 1; i <= taskExecutions; i++) {
-      pool
-        .execute(workerData)
-        .then(() => {
-          ++executions
-          if (executions === taskExecutions) {
-            resolve({ ok: 1 })
-          }
-          return undefined
-        })
-        .catch(err => {
-          console.error(err)
-          reject(err)
-        })
-    }
-  })
+  for (let i = 1; i <= taskExecutions; i++) {
+    await pool.execute(workerData)
+  }
 }
 
 export const runPoolifierBenchmarkTatamiNg = async (