4 } = require('../../../lib/index')
5 const { runPoolifierTest
} = require('../benchmark-utils')
8 const numberOfTasks
= 1
10 const dynamicPool
= new DynamicThreadPool(
13 './benchmarks/internal/thread/worker.js'
16 const dynamicPoolLessRecentlyUsed
= new DynamicThreadPool(
19 './benchmarks/internal/thread/worker.js',
20 { workerChoiceStrategy
: WorkerChoiceStrategies
.LESS_RECENTLY_USED
}
23 const dynamicPoolFairShare
= new DynamicThreadPool(
26 './benchmarks/internal/thread/worker.js',
27 { workerChoiceStrategy
: WorkerChoiceStrategies
.FAIR_SHARE
}
30 async
function dynamicThreadTest (
31 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
33 return runPoolifierTest(dynamicPool
, { tasks
, workerData
})
36 async
function dynamicThreadTestLessRecentlyUsed (
37 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
39 return runPoolifierTest(dynamicPoolLessRecentlyUsed
, { tasks
, workerData
})
42 async
function dynamicThreadTestFairShare (
43 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
45 return runPoolifierTest(dynamicPoolFairShare
, { tasks
, workerData
})
50 dynamicThreadTestFairShare
,
51 dynamicThreadTestLessRecentlyUsed