From 932da73291d65036a331363d6301072c023d1bd9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 27 Jun 2023 20:55:36 +0200 Subject: [PATCH] refactor: cleanup benchmarks export MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- benchmarks/benchmarks-types.mjs | 8 +++----- benchmarks/benchmarks-utils.mjs | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) 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 -- 2.34.1