perf(benchmark): only benchmark poolifier run with mitata
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 6 Apr 2024 16:27:15 +0000 (18:27 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 6 Apr 2024 16:27:15 +0000 (18:27 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
benchmarks/benchmarks-utils.mjs
package.json
pnpm-lock.yaml

index 48101fdaadc434073f81906a0ad0d7095e3f675a..06ebbfa15a72aefa15df416fe25fd366e5e8ed5b 100644 (file)
@@ -268,23 +268,27 @@ export const runPoolifierBenchmarkMitata = async (
                   enableTasksQueue ? 'with' : 'without'
                 } tasks queue`,
                 async () => {
-                  pool.setWorkerChoiceStrategy(workerChoiceStrategy, {
-                    measurement
-                  })
-                  pool.enableTasksQueue(enableTasksQueue)
-                  strictEqual(
-                    pool.opts.workerChoiceStrategy,
-                    workerChoiceStrategy
-                  )
-                  strictEqual(pool.opts.enableTasksQueue, enableTasksQueue)
-                  strictEqual(
-                    pool.opts.workerChoiceStrategyOptions.measurement,
-                    measurement
-                  )
                   await runPoolifierPool(pool, {
                     taskExecutions,
                     workerData
                   })
+                },
+                {
+                  before: () => {
+                    pool.setWorkerChoiceStrategy(workerChoiceStrategy, {
+                      measurement
+                    })
+                    pool.enableTasksQueue(enableTasksQueue)
+                    strictEqual(
+                      pool.opts.workerChoiceStrategy,
+                      workerChoiceStrategy
+                    )
+                    strictEqual(pool.opts.enableTasksQueue, enableTasksQueue)
+                    strictEqual(
+                      pool.opts.workerChoiceStrategyOptions.measurement,
+                      measurement
+                    )
+                  }
                 }
               )
             })
@@ -296,17 +300,21 @@ export const runPoolifierBenchmarkMitata = async (
                 enableTasksQueue ? 'with' : 'without'
               } tasks queue`,
               async () => {
-                pool.setWorkerChoiceStrategy(workerChoiceStrategy)
-                pool.enableTasksQueue(enableTasksQueue)
-                strictEqual(
-                  pool.opts.workerChoiceStrategy,
-                  workerChoiceStrategy
-                )
-                strictEqual(pool.opts.enableTasksQueue, enableTasksQueue)
                 await runPoolifierPool(pool, {
                   taskExecutions,
                   workerData
                 })
+              },
+              {
+                before: () => {
+                  pool.setWorkerChoiceStrategy(workerChoiceStrategy)
+                  pool.enableTasksQueue(enableTasksQueue)
+                  strictEqual(
+                    pool.opts.workerChoiceStrategy,
+                    workerChoiceStrategy
+                  )
+                  strictEqual(pool.opts.enableTasksQueue, enableTasksQueue)
+                }
               }
             )
           })
@@ -314,8 +322,8 @@ export const runPoolifierBenchmarkMitata = async (
       }
     }
     await run()
-    await pool.destroy()
     clear()
+    await pool.destroy()
   } catch (error) {
     console.error(error)
   }
index 1a54f8d52245e111208a36c09694cbd0df3b7a8e..96e7e9e8d13370d0018a59e45efbf31c1dff64c8 100644 (file)
     "husky": "^9.0.11",
     "lint-staged": "^15.2.2",
     "microtime": "^3.1.1",
-    "mitata": "github:jerome-benoit/mitata#master",
+    "mitata": "github:poolifier/mitata#master",
     "mocha": "^10.4.0",
     "mochawesome": "^7.1.3",
     "prettier": "^3.2.5",
index 6577e06ab1c72cfdcd7d5bb0bd38dde536d1c3f2..be574dd49f693c11c8fdc9ac8b91161252a681ba 100644 (file)
@@ -96,8 +96,8 @@ devDependencies:
     specifier: ^3.1.1
     version: 3.1.1
   mitata:
-    specifier: github:jerome-benoit/mitata#master
-    version: github.com/jerome-benoit/mitata/07d9e3698201592d5babe9b8eaa58534ddeb6bd2(typescript@5.4.4)
+    specifier: github:poolifier/mitata#master
+    version: github.com/poolifier/mitata/e2a0e660f0c0974620bf53a2b9d6ef93e706bd34(typescript@5.4.4)
   mocha:
     specifier: ^10.4.0
     version: 10.4.0
@@ -5777,9 +5777,9 @@ packages:
     engines: {node: '>=12.20'}
     dev: true
 
-  github.com/jerome-benoit/mitata/07d9e3698201592d5babe9b8eaa58534ddeb6bd2(typescript@5.4.4):
-    resolution: {tarball: https://codeload.github.com/jerome-benoit/mitata/tar.gz/07d9e3698201592d5babe9b8eaa58534ddeb6bd2}
-    id: github.com/jerome-benoit/mitata/07d9e3698201592d5babe9b8eaa58534ddeb6bd2
+  github.com/poolifier/mitata/e2a0e660f0c0974620bf53a2b9d6ef93e706bd34(typescript@5.4.4):
+    resolution: {tarball: https://codeload.github.com/poolifier/mitata/tar.gz/e2a0e660f0c0974620bf53a2b9d6ef93e706bd34}
+    id: github.com/poolifier/mitata/e2a0e660f0c0974620bf53a2b9d6ef93e706bd34
     name: mitata
     version: 0.1.11
     requiresBuild: true