From: Jérôme Benoit Date: Tue, 27 Jun 2023 18:55:36 +0000 (+0200) Subject: refactor: cleanup benchmarks export X-Git-Tag: v2.6.6~17 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=932da73291d65036a331363d6301072c023d1bd9;p=poolifier.git refactor: cleanup benchmarks export Signed-off-by: Jérôme Benoit --- diff --git a/benchmarks/benchmarks-types.mjs b/benchmarks/benchmarks-types.mjs index f7d8bdb9..cbd254e0 100644 --- a/benchmarks/benchmarks-types.mjs +++ b/benchmarks/benchmarks-types.mjs @@ -1,18 +1,16 @@ -const WorkerFunctions = { +export const WorkerFunctions = { jsonIntegerSerialization: 'jsonIntegerSerialization', fibonacci: 'fibonacci', factorial: 'factorial', readWriteFiles: 'readWriteFiles' } -const PoolTypes = { +export const PoolTypes = { fixed: 'fixed', dynamic: 'dynamic' } -const WorkerTypes = { +export const WorkerTypes = { thread: 'thread', cluster: 'cluster' } - -export { PoolTypes, WorkerFunctions, WorkerTypes } diff --git a/benchmarks/benchmarks-utils.mjs b/benchmarks/benchmarks-utils.mjs index 9435b0d3..d2f4fc23 100644 --- a/benchmarks/benchmarks-utils.mjs +++ b/benchmarks/benchmarks-utils.mjs @@ -55,7 +55,7 @@ function jsonIntegerSerialization (n) { * @param {number} n - The number of fibonacci numbers to generate. * @returns {number} - The nth fibonacci number. */ -export function fibonacci (n) { +function fibonacci (n) { if (n <= 1) return n return fibonacci(n - 1) + fibonacci(n - 2) } @@ -65,14 +65,14 @@ export function fibonacci (n) { * @param {number} n - The number to calculate the factorial of. * @returns {number} - The factorial of n. */ -export function factorial (n) { +function factorial (n) { if (n === 0) { return 1 } return factorial(n - 1) * n } -export function readWriteFiles ( +function readWriteFiles ( n, baseDirectory = `/tmp/poolifier-benchmarks/${crypto.randomInt( 281474976710655