chore: apply depedencies update
[poolifier.git] / benchmarks / internal / thread / fixed.js
index 617aa7e5950952c241c2c98a091e2cf8965553b6..3f40f3fbcac920f9f4013bdb59d3c155fdb42b57 100644 (file)
@@ -2,7 +2,7 @@ const {
   FixedThreadPool,
   WorkerChoiceStrategies
 } = require('../../../lib/index')
-const { runPoolifierTest } = require('../benchmark-utils')
+const { runPoolifierTest } = require('../../benchmarks-utils')
 
 const size = 30
 const numberOfTasks = 1
@@ -18,6 +18,18 @@ const fixedPoolLessRecentlyUsed = new FixedThreadPool(
   { workerChoiceStrategy: WorkerChoiceStrategies.LESS_RECENTLY_USED }
 )
 
+const fixedPoolWeightedRoundRobin = new FixedThreadPool(
+  size,
+  './benchmarks/internal/thread/worker.js',
+  { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN }
+)
+
+const fixedPoolFairShare = new FixedThreadPool(
+  size,
+  './benchmarks/internal/thread/worker.js',
+  { workerChoiceStrategy: WorkerChoiceStrategies.FAIR_SHARE }
+)
+
 async function fixedThreadTest (
   { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
 ) {
@@ -30,4 +42,21 @@ async function fixedThreadTestLessRecentlyUsed (
   return runPoolifierTest(fixedPoolLessRecentlyUsed, { tasks, workerData })
 }
 
-module.exports = { fixedThreadTest, fixedThreadTestLessRecentlyUsed }
+async function fixedThreadTestWeightedRoundRobin (
+  { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
+) {
+  return runPoolifierTest(fixedPoolWeightedRoundRobin, { tasks, workerData })
+}
+
+async function fixedThreadTestFairShare (
+  { tasks, workerData } = { tasks: numberOfTasks, workerData: { proof: 'ok' } }
+) {
+  return runPoolifierTest(fixedPoolFairShare, { tasks, workerData })
+}
+
+module.exports = {
+  fixedThreadTest,
+  fixedThreadTestLessRecentlyUsed,
+  fixedThreadTestWeightedRoundRobin,
+  fixedThreadTestFairShare
+}