const tasks = 1
// pools
-const fixedPool = new FixedThreadPool(size,
- './yourWorker.js', { maxTasks: 10000 })
-const dynamicPool = new DynamicThreadPool(size / 2, size * 3, './yourWorker.js', { maxTasks: 10000 })
+const fixedPool = new FixedThreadPool(size, './yourWorker.js', {
+ maxTasks: 10000
+})
+const dynamicPool = new DynamicThreadPool(
+ size / 2,
+ size * 3,
+ './yourWorker.js',
+ { maxTasks: 10000 }
+)
const workerData = { proof: 'ok' }
// wait some seconds before start, my pools need to load threads !!!
async function test () {
// add tests
- suite.add('PioardiStaticPool', async function () {
- await fixedTest()
- })
+ suite
+ .add('PioardiStaticPool', async function () {
+ await fixedTest()
+ })
.add('PioardiDynamicPool', async function () {
await dynamicTest()
})
- // add listeners
+ // add listeners
.on('cycle', function (event) {
console.log(String(event.target))
})
this.filter('fastest').map('name')
console.log('Fastest is ' + this.filter('fastest').map('name'))
})
- // run async
+ // run async
.run({ async: true })
}