docs: refine benchmark README.md
[poolifier.git] / benchmarks / internal / bench.mjs
index c20b011f22afe762c36cde0ad6e7a1340586b170..891ff9eca7118d5bb530e43d23315dcbdfa7c59f 100644 (file)
@@ -10,6 +10,7 @@ import { TaskFunctions } from '../benchmarks-types.mjs'
 import {
   LIST_FORMATTER,
   buildPoolifierPool,
+  getPoolImplementationName,
   runPoolifierTest
 } from '../benchmarks-utils.mjs'
 
@@ -32,7 +33,7 @@ for (const pool of [fixedThreadPool]) {
   for (const workerChoiceStrategy of Object.values(WorkerChoiceStrategies)) {
     for (const enableTasksQueue of [false, true]) {
       poolifierSuite.add(
-        `${pool.constructor.name}|${workerChoiceStrategy}|${
+        `${getPoolImplementationName(pool)}|${workerChoiceStrategy}|${
           enableTasksQueue ? 'with' : 'without'
         } tasks queue`,
         async () => {
@@ -57,10 +58,10 @@ poolifierSuite
   .on('cycle', event => {
     console.info(event.target.toString())
   })
-  .on('complete', function () {
+  .on('complete', async function () {
     console.info(
       'Fastest is ' + LIST_FORMATTER.format(this.filter('fastest').map('name'))
     )
-    fixedThreadPool.destroy()
+    await fixedThreadPool.destroy()
   })
   .run({ async: true })