import { strictEqual } from 'node:assert'
import Benchmark from 'benchmark'
-import { bench, group } from 'mitata'
+import { bench, clear, group, run } from 'tatami-ng'
import {
DynamicClusterPool,
})
}
-export const buildPoolifierBenchmarkMitata = (
+export const runPoolifierBenchmarkTatamiNg = async (
name,
workerType,
poolType,
enableTasksQueue ? 'with' : 'without'
} tasks queue`,
async () => {
- pool.setWorkerChoiceStrategy(workerChoiceStrategy, {
- measurement
- })
- pool.enableTasksQueue(enableTasksQueue)
- strictEqual(
- pool.opts.workerChoiceStrategy,
- workerChoiceStrategy
- )
- strictEqual(pool.opts.enableTasksQueue, enableTasksQueue)
- strictEqual(
- pool.opts.workerChoiceStrategyOptions.measurement,
- measurement
- )
await runPoolifierPool(pool, {
taskExecutions,
workerData
})
+ },
+ {
+ before: () => {
+ pool.setWorkerChoiceStrategy(workerChoiceStrategy, {
+ measurement
+ })
+ pool.enableTasksQueue(enableTasksQueue)
+ strictEqual(
+ pool.opts.workerChoiceStrategy,
+ workerChoiceStrategy
+ )
+ strictEqual(pool.opts.enableTasksQueue, enableTasksQueue)
+ strictEqual(
+ pool.opts.workerChoiceStrategyOptions.measurement,
+ measurement
+ )
+ }
}
)
})
enableTasksQueue ? 'with' : 'without'
} tasks queue`,
async () => {
- pool.setWorkerChoiceStrategy(workerChoiceStrategy)
- pool.enableTasksQueue(enableTasksQueue)
- strictEqual(
- pool.opts.workerChoiceStrategy,
- workerChoiceStrategy
- )
- strictEqual(pool.opts.enableTasksQueue, enableTasksQueue)
await runPoolifierPool(pool, {
taskExecutions,
workerData
})
+ },
+ {
+ before: () => {
+ pool.setWorkerChoiceStrategy(workerChoiceStrategy)
+ pool.enableTasksQueue(enableTasksQueue)
+ strictEqual(
+ pool.opts.workerChoiceStrategy,
+ workerChoiceStrategy
+ )
+ strictEqual(pool.opts.enableTasksQueue, enableTasksQueue)
+ }
}
)
})
}
}
}
- return pool
+ await run()
+ clear()
+ await pool.destroy()
} catch (error) {
console.error(error)
}