} from '../lib/index.mjs'
import { PoolTypes, WorkerFunctions, WorkerTypes } from './benchmarks-types.mjs'
-async function runTest (pool, { taskExecutions, workerData }) {
+export async function runTest (pool, { taskExecutions, workerData }) {
return new Promise((resolve, reject) => {
let executions = 0
for (let i = 1; i <= taskExecutions; i++) {
})
}
-function generateRandomInteger (max = Number.MAX_SAFE_INTEGER, min = 0) {
+export function generateRandomInteger (max = Number.MAX_SAFE_INTEGER, min = 0) {
if (max < min || max < 0 || min < 0) {
throw new RangeError('Invalid interval')
}
* @returns {number} - The nth fibonacci number.
*/
function fibonacci (n) {
- if (n <= 1) return 1
+ if (n <= 1) return n
return fibonacci(n - 1) + fibonacci(n - 2)
}
fs.rmSync(baseDirectory, { recursive: true })
}
-function executeWorkerFunction (data) {
+export function executeWorkerFunction (data) {
switch (data.function) {
case WorkerFunctions.jsonIntegerSerialization:
return jsonIntegerSerialization(data.taskSize || 1000)
}
}
-function buildPool (workerType, poolType, poolSize, poolOptions) {
+export function buildPool (workerType, poolType, poolSize, poolOptions) {
switch (poolType) {
case PoolTypes.fixed:
switch (workerType) {
break
}
}
-
-export {
- WorkerFunctions,
- buildPool,
- executeWorkerFunction,
- generateRandomInteger,
- readWriteFiles,
- runTest
-}