fix: readd cpu speed computation but only if necessary
[poolifier.git] / benchmarks / benchmarks-utils.cjs
index e94910984831770041715c33b301f6a68c4ec862..b4a0d9bd8dd518420330ea5700fe1972b6995027 100644 (file)
@@ -89,8 +89,8 @@ const runPoolifierPoolBenchmark = async (
 ) => {
   return await new Promise((resolve, reject) => {
     const pool = buildPoolifierPool(workerType, poolType, poolSize)
-    const suite = new Benchmark.Suite(name)
     try {
+      const suite = new Benchmark.Suite(name)
       for (const workerChoiceStrategy of Object.values(
         WorkerChoiceStrategies
       )) {
@@ -186,18 +186,6 @@ const LIST_FORMATTER = new Intl.ListFormat('en-US', {
   type: 'conjunction'
 })
 
-const generateRandomInteger = (max = Number.MAX_SAFE_INTEGER, min = 0) => {
-  if (max < min || max < 0 || min < 0) {
-    throw new RangeError('Invalid interval')
-  }
-  max = Math.floor(max)
-  if (min != null && min !== 0) {
-    min = Math.ceil(min)
-    return Math.floor(Math.random() * (max - min + 1)) + min
-  }
-  return Math.floor(Math.random() * (max + 1))
-}
-
 const jsonIntegerSerialization = n => {
   for (let i = 0; i < n; i++) {
     const o = {
@@ -268,6 +256,5 @@ const executeTaskFunction = data => {
 module.exports = {
   LIST_FORMATTER,
   executeTaskFunction,
-  generateRandomInteger,
   runPoolifierPoolBenchmark
 }