-import { PoolTypes, WorkerTypes } from '../lib/index.mjs'
-
-const WorkerFunctions = {
+export const WorkerFunctions = {
jsonIntegerSerialization: 'jsonIntegerSerialization',
fibonacci: 'fibonacci',
factorial: 'factorial',
readWriteFiles: 'readWriteFiles'
}
-
-export { PoolTypes, WorkerFunctions, WorkerTypes }
DynamicClusterPool,
DynamicThreadPool,
FixedClusterPool,
- FixedThreadPool
+ FixedThreadPool,
+ PoolTypes,
+ WorkerTypes
} from '../lib/index.mjs'
-import { PoolTypes, WorkerFunctions, WorkerTypes } from './benchmarks-types.mjs'
+import { WorkerFunctions } from './benchmarks-types.mjs'
export const runTest = async (pool, { taskExecutions, workerData }) => {
return new Promise((resolve, reject) => {
import { add, complete, cycle, save, suite } from 'benny'
import {
+ Measurements,
+ PoolTypes,
WorkerChoiceStrategies,
+ WorkerTypes,
availableParallelism
} from '../../lib/index.mjs'
-import {
- PoolTypes,
- WorkerFunctions,
- WorkerTypes
-} from '../benchmarks-types.mjs'
+import { WorkerFunctions } from '../benchmarks-types.mjs'
import { buildPool, runTest } from '../benchmarks-utils.mjs'
const poolSize = availableParallelism()
continue
}
for (const workerChoiceStrategy of Object.values(WorkerChoiceStrategies)) {
- for (const tasksQueue of [false, true]) {
- const pool = buildPool(
- workerType,
- poolType,
- poolSize,
- tasksQueue
- ? {
- ...{
- workerChoiceStrategy
- },
- ...{ enableTasksQueue: true }
- }
- : {
- workerChoiceStrategy
- }
- )
- pools.push([
- `${poolType}|${workerType}|${workerChoiceStrategy}|tasks queue:${tasksQueue}`,
- pool
- ])
+ for (const enableTasksQueue of [false, true]) {
+ if (workerChoiceStrategy === WorkerChoiceStrategies.FAIR_SHARE) {
+ for (const measurement of [Measurements.runTime, Measurements.elu]) {
+ const pool = buildPool(workerType, poolType, poolSize, {
+ workerChoiceStrategy,
+ workerChoiceStrategyOptions: {
+ measurement
+ },
+ enableTasksQueue
+ })
+ pools.push([
+ `${poolType}|${workerType}|${workerChoiceStrategy}|tasks queue:${enableTasksQueue}|measurement:${measurement}`,
+ pool
+ ])
+ }
+ } else {
+ const pool = buildPool(workerType, poolType, poolSize, {
+ workerChoiceStrategy,
+ enableTasksQueue
+ })
+ pools.push([
+ `${poolType}|${workerType}|${workerChoiceStrategy}|tasks queue:${enableTasksQueue}`,
+ pool
+ ])
+ }
}
}
}