summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2d786ac)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
+// eslint-disable-next-line node/no-unpublished-require
const { defineConfig } = require('eslint-define-config')
module.exports = defineConfig({
const { defineConfig } = require('eslint-define-config')
module.exports = defineConfig({
extends: [
'standard',
'eslint:recommended',
extends: [
'standard',
'eslint:recommended',
+ 'plugin:node/recommended',
+ 'plugin:jsdoc/recommended',
'plugin:import/recommended',
'plugin:promise/recommended',
'plugin:prettierx/standardx'
'plugin:import/recommended',
'plugin:promise/recommended',
'plugin:prettierx/standardx'
+/**
+ * @param max
+ * @param min
+ */
function generateRandomInteger (max, min = 0) {
if (min) {
return Math.floor(Math.random() * (max - min + 1) + min)
function generateRandomInteger (max, min = 0) {
if (min) {
return Math.floor(Math.random() * (max - min + 1) + min)
+/**
+ * @param timeoutMs
+ */
function dummyTimeoutBusyWait (timeoutMs) {
const timeoutDateMs = Date.now() + timeoutMs
do {} while (Date.now() < timeoutDateMs)
}
function dummyTimeoutBusyWait (timeoutMs) {
const timeoutDateMs = Date.now() + timeoutMs
do {} while (Date.now() < timeoutDateMs)
}
+/**
+ * @param timeoutMs
+ * @param delayMs
+ */
function setIntervalTimeoutBusyWait (timeoutMs, delayMs = 200) {
const tries = Math.round(timeoutMs / delayMs)
let count = 0
function setIntervalTimeoutBusyWait (timeoutMs, delayMs = 200) {
const tries = Math.round(timeoutMs / delayMs)
let count = 0
const suite = new Benchmark.Suite()
const suite = new Benchmark.Suite()
function promise () {
return new Promise()
}
function promise () {
return new Promise()
}
async function asyncFunction () {
await promise()
}
async function asyncFunction () {
await promise()
}
const suite = new Benchmark.Suite()
const suite = new Benchmark.Suite()
+/**
+ * @param numberOfWorkers
+ * @param maxNumberOfTasksPerWorker
+ */
function generateRandomTasksMap (
numberOfWorkers,
maxNumberOfTasksPerWorker = 10
function generateRandomTasksMap (
numberOfWorkers,
maxNumberOfTasksPerWorker = 10
const tasksMap = generateRandomTasksMap(60, 20)
const tasksMap = generateRandomTasksMap(60, 20)
+/**
+ * @param tasksMap
+ */
function loopSelect (tasksMap) {
let minValue = Infinity
let minKey
function loopSelect (tasksMap) {
let minValue = Infinity
let minKey
return [minKey, minValue]
}
return [minKey, minValue]
}
+/**
+ * @param tasksMap
+ */
function arraySortSelect (tasksMap) {
const tasksArray = Array.from(tasksMap)
return tasksArray.sort((a, b) => {
function arraySortSelect (tasksMap) {
const tasksArray = Array.from(tasksMap)
return tasksArray.sort((a, b) => {
return generateRandomInteger(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
}
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
+ */
function partition (
array,
leftIndex,
function partition (
array,
leftIndex,
+/**
+ * @param array
+ * @param k
+ * @param leftIndex
+ * @param rightIndex
+ * @param compare
+ * @param pivotIndexSelect
+ */
function selectLoop (
array,
k,
function selectLoop (
array,
k,
+/**
+ * @param array
+ * @param k
+ * @param leftIndex
+ * @param rightIndex
+ * @param compare
+ * @param pivotIndexSelect
+ */
function selectRecursion (
array,
k,
function selectRecursion (
array,
k,
+/**
+ * @param tasksMap
+ */
function quickSelectLoop (tasksMap) {
const tasksArray = Array.from(tasksMap)
function quickSelectLoop (tasksMap) {
const tasksArray = Array.from(tasksMap)
+/**
+ * @param tasksMap
+ */
function quickSelectLoopRandomPivot (tasksMap) {
const tasksArray = Array.from(tasksMap)
function quickSelectLoopRandomPivot (tasksMap) {
const tasksArray = Array.from(tasksMap)
+/**
+ * @param tasksMap
+ */
function quickSelectRecursion (tasksMap) {
const tasksArray = Array.from(tasksMap)
function quickSelectRecursion (tasksMap) {
const tasksArray = Array.from(tasksMap)
+/**
+ * @param tasksMap
+ */
function quickSelectRecursionRandomPivot (tasksMap) {
const tasksArray = Array.from(tasksMap)
function quickSelectRecursionRandomPivot (tasksMap) {
const tasksArray = Array.from(tasksMap)