4 } = require('../../../lib/index')
5 const { runPoolifierTest
} = require('../../benchmarks-utils')
8 const numberOfTasks
= 1
10 const dynamicPool
= new DynamicThreadPool(
13 './benchmarks/internal/thread/worker.js'
16 const dynamicPoolLessUsed
= new DynamicThreadPool(
19 './benchmarks/internal/thread/worker.js',
20 { workerChoiceStrategy
: WorkerChoiceStrategies
.LESS_USED
}
23 const dynamicPoolLessBusy
= new DynamicThreadPool(
26 './benchmarks/internal/thread/worker.js',
27 { workerChoiceStrategy
: WorkerChoiceStrategies
.LESS_BUSY
}
30 const dynamicPoolWeightedRoundRobin
= new DynamicThreadPool(
33 './benchmarks/internal/thread/worker.js',
34 { workerChoiceStrategy
: WorkerChoiceStrategies
.WEIGHTED_ROUND_ROBIN
}
37 const dynamicPoolFairShare
= new DynamicThreadPool(
40 './benchmarks/internal/thread/worker.js',
41 { workerChoiceStrategy
: WorkerChoiceStrategies
.FAIR_SHARE
}
44 async
function dynamicThreadTest (
45 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
47 return runPoolifierTest(dynamicPool
, { tasks
, workerData
})
50 async
function dynamicThreadTestLessUsed (
51 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
53 return runPoolifierTest(dynamicPoolLessUsed
, { tasks
, workerData
})
56 async
function dynamicThreadTestLessBusy (
57 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
59 return runPoolifierTest(dynamicPoolLessBusy
, { tasks
, workerData
})
62 async
function dynamicThreadTestWeightedRoundRobin (
63 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
65 return runPoolifierTest(dynamicPoolWeightedRoundRobin
, { tasks
, workerData
})
68 async
function dynamicThreadTestFairShare (
69 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
71 return runPoolifierTest(dynamicPoolFairShare
, { tasks
, workerData
})
76 dynamicThreadTestLessUsed
,
77 dynamicThreadTestLessBusy
,
78 dynamicThreadTestWeightedRoundRobin
,
79 dynamicThreadTestFairShare