chore: v3.1.26
[poolifier.git] / benchmarks / internal / bench.mjs
index 3484951cfb187a42bf1af5f325cd1c436adb6baf..b59514d225b45adf149f011798156af1a7bcf675 100644 (file)
@@ -1,13 +1,12 @@
+import { exit } from 'node:process'
+
 import {
+  availableParallelism,
   PoolTypes,
-  WorkerTypes,
-  availableParallelism
+  WorkerTypes
 } from '../../lib/index.mjs'
-import { TaskFunctions } from '../benchmarks-types.mjs'
-import {
-  buildPoolifierPool,
-  runPoolifierPoolBenchmark
-} from '../benchmarks-utils.mjs'
+import { TaskFunctions } from '../benchmarks-types.cjs'
+import { runPoolifierPoolBenchmark } from '../benchmarks-utils.cjs'
 
 const poolSize = availableParallelism()
 const taskExecutions = 1
@@ -18,8 +17,10 @@ const workerData = {
 
 // FixedThreadPool
 await runPoolifierPoolBenchmark(
-  'Poolifier FixedThreadPool',
-  buildPoolifierPool(WorkerTypes.thread, PoolTypes.fixed, poolSize),
+  'FixedThreadPool',
+  WorkerTypes.thread,
+  PoolTypes.fixed,
+  poolSize,
   {
     taskExecutions,
     workerData
@@ -28,10 +29,38 @@ await runPoolifierPoolBenchmark(
 
 // DynamicThreadPool
 await runPoolifierPoolBenchmark(
-  'Poolifier DynamicThreadPool',
-  buildPoolifierPool(WorkerTypes.thread, PoolTypes.dynamic, poolSize),
+  'DynamicThreadPool',
+  WorkerTypes.thread,
+  PoolTypes.dynamic,
+  poolSize,
+  {
+    taskExecutions,
+    workerData
+  }
+)
+
+// FixedClusterPool
+await runPoolifierPoolBenchmark(
+  'FixedClusterPool',
+  WorkerTypes.cluster,
+  PoolTypes.fixed,
+  poolSize,
   {
     taskExecutions,
     workerData
   }
 )
+
+// DynamicClusterPool
+await runPoolifierPoolBenchmark(
+  'DynamicClusterPool',
+  WorkerTypes.cluster,
+  PoolTypes.dynamic,
+  poolSize,
+  {
+    taskExecutions,
+    workerData
+  }
+)
+
+exit()