4 } = require('../../../lib/index')
5 const { runPoolifierTest
} = require('../benchmark-utils')
8 const numberOfTasks
= 1
10 const fixedPool
= new FixedThreadPool(
12 './benchmarks/internal/thread/worker.js'
15 const fixedPoolLessRecentlyUsed
= new FixedThreadPool(
17 './benchmarks/internal/thread/worker.js',
18 { workerChoiceStrategy
: WorkerChoiceStrategies
.LESS_RECENTLY_USED
}
21 const fixedPoolFairShare
= new FixedThreadPool(
23 './benchmarks/internal/thread/worker.js',
24 { workerChoiceStrategy
: WorkerChoiceStrategies
.FAIR_SHARE
}
27 async
function fixedThreadTest (
28 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
30 return runPoolifierTest(fixedPool
, { tasks
, workerData
})
33 async
function fixedThreadTestLessRecentlyUsed (
34 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
36 return runPoolifierTest(fixedPoolLessRecentlyUsed
, { tasks
, workerData
})
39 async
function fixedThreadTestFairShare (
40 { tasks
, workerData
} = { tasks
: numberOfTasks
, workerData
: { proof
: 'ok' } }
42 return runPoolifierTest(fixedPoolFairShare
, { tasks
, workerData
})
47 fixedThreadTestFairShare
,
48 fixedThreadTestLessRecentlyUsed