Refine eslint configuration
[benchmarks-js.git] / quick-select.js
index cf8f23540d31add705554d9ccb71ac4b3339e0ca..502673530c3f84ca59af562e2d584e0c8e2ef32f 100644 (file)
@@ -3,6 +3,11 @@ const { generateRandomInteger, LIST_FORMATTER } = require('./benchmark-utils')
 
 const suite = new Benchmark.Suite()
 
+/**
+ * @param numberOfWorkers
+ * @param maxNumberOfTasksPerWorker
+ * @returns
+ */
 function generateRandomTasksMap (
   numberOfWorkers,
   maxNumberOfTasksPerWorker = 10
@@ -17,6 +22,10 @@ function generateRandomTasksMap (
 
 const tasksMap = generateRandomTasksMap(60, 20)
 
+/**
+ * @param tasksMap
+ * @returns
+ */
 function loopSelect (tasksMap) {
   let minValue = Infinity
   let minKey
@@ -31,6 +40,10 @@ function loopSelect (tasksMap) {
   return [minKey, minValue]
 }
 
+/**
+ * @param tasksMap
+ * @returns
+ */
 function arraySortSelect (tasksMap) {
   const tasksArray = Array.from(tasksMap)
   return tasksArray.sort((a, b) => {
@@ -55,12 +68,25 @@ const randomPivotIndexSelect = (leftIndex, rightIndex) => {
   return generateRandomInteger(leftIndex, rightIndex)
 }
 
+/**
+ * @param array
+ * @param index1
+ * @param index2
+ */
 function swap (array, index1, index2) {
   const tmp = array[index1]
   array[index1] = array[index2]
   array[index2] = tmp
 }
 
+/**
+ * @param array
+ * @param leftIndex
+ * @param rightIndex
+ * @param pivotIndex
+ * @param compare
+ * @returns
+ */
 function partition (
   array,
   leftIndex,
@@ -81,6 +107,15 @@ function partition (
   return storeIndex
 }
 
+/**
+ * @param array
+ * @param k
+ * @param leftIndex
+ * @param rightIndex
+ * @param compare
+ * @param pivotIndexSelect
+ * @returns
+ */
 function selectLoop (
   array,
   k,
@@ -103,6 +138,15 @@ function selectLoop (
   }
 }
 
+/**
+ * @param array
+ * @param k
+ * @param leftIndex
+ * @param rightIndex
+ * @param compare
+ * @param pivotIndexSelect
+ * @returns
+ */
 function selectRecursion (
   array,
   k,
@@ -123,6 +167,10 @@ function selectRecursion (
   }
 }
 
+/**
+ * @param tasksMap
+ * @returns
+ */
 function quickSelectLoop (tasksMap) {
   const tasksArray = Array.from(tasksMap)
 
@@ -131,6 +179,10 @@ function quickSelectLoop (tasksMap) {
   })
 }
 
+/**
+ * @param tasksMap
+ * @returns
+ */
 function quickSelectLoopRandomPivot (tasksMap) {
   const tasksArray = Array.from(tasksMap)
 
@@ -146,6 +198,10 @@ function quickSelectLoopRandomPivot (tasksMap) {
   )
 }
 
+/**
+ * @param tasksMap
+ * @returns
+ */
 function quickSelectRecursion (tasksMap) {
   const tasksArray = Array.from(tasksMap)
 
@@ -154,6 +210,10 @@ function quickSelectRecursion (tasksMap) {
   })
 }
 
+/**
+ * @param tasksMap
+ * @returns
+ */
 function quickSelectRecursionRandomPivot (tasksMap) {
   const tasksArray = Array.from(tasksMap)
 
@@ -203,7 +263,7 @@ suite
     console.log(
       'Fastest is ' + LIST_FORMATTER.format(this.filter('fastest').map('name'))
     )
-    // eslint-disable-next-line no-process-exit
+    // eslint-disable-next-line n/no-process-exit
     process.exit()
   })
   .run()