*
* @param numberOfWorkers
* @param maxNumberOfTasksPerWorker
+ * @returns
*/
function generateRandomTasksMap (
numberOfWorkers,
/**
*
* @param tasksMap
+ * @returns
*/
function loopSelect (tasksMap) {
let minKey
/**
*
* @param tasksMap
+ * @returns
*/
function arraySortSelect (tasksMap) {
const tasksArray = Array.from(tasksMap)
* @param rightIndex
* @param pivotIndex
* @param compare
+ * @returns
*/
function partition (
array,
* @param rightIndex
* @param compare
* @param pivotIndexSelect
+ * @returns
*/
function selectLoop (
array,
* @param rightIndex
* @param compare
* @param pivotIndexSelect
+ * @returns
*/
function selectRecursion (
array,
/**
*
* @param tasksMap
+ * @returns
*/
function quickSelectLoop (tasksMap) {
const tasksArray = Array.from(tasksMap)
/**
*
* @param tasksMap
+ * @returns
*/
function quickSelectLoopRandomPivot (tasksMap) {
const tasksArray = Array.from(tasksMap)
/**
*
* @param tasksMap
+ * @returns
*/
function quickSelectRecursion (tasksMap) {
const tasksArray = Array.from(tasksMap)
/**
*
* @param tasksMap
+ * @returns
*/
function quickSelectRecursionRandomPivot (tasksMap) {
const tasksArray = Array.from(tasksMap)
/**
*
* @param numberOfWorkers
+ * @returns
*/
function generateWorkersArray (numberOfWorkers) {
return [...Array(numberOfWorkers).keys()]
let nextWorkerIndex
/**
- *
+ * @returns
*/
function roundRobinTernaryOffByOne () {
nextWorkerIndex =
}
/**
- *
+ * @returns
*/
function roundRobinTernaryWithNegation () {
nextWorkerIndex =
}
/**
- *
+ * @returns
*/
function roundRobinTernaryWithPreChoosing () {
const chosenWorker = workers[nextWorkerIndex]
}
/**
- *
+ * @returns
*/
function roundRobinIncrementModulo () {
const chosenWorker = workers[nextWorkerIndex]
js.configs.recommended,
...nodePlugin.configs['flat/mixed-esm-and-cjs'],
jsdoc.configs['flat/recommended-typescript'],
+ {
+ rules: {
+ 'jsdoc/check-tag-names': ['warn', { typed: true, definedTags: ['defaultValue', 'experimental', 'typeParam'] }],
+ },
+ },
...tseslint.config(
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked
/**
*
* @param data
+ * @returns
*/
function fn0 (data) {
console.info('Executing fn0')
/**
*
* @param data
+ * @returns
*/
function fn1 (data) {
console.info('Executing fn1')
const { ThreadWorker } = require('poolifier')
/**
- *
+ * @returns
*/
function yourFunction () {
for (let i = 0; i <= 1000; i++) {
/**
* The pool readiness boolean status.
+ * @returns The pool readiness status.
*/
private get ready (): boolean {
if (this.empty) {
/**
* The pool emptiness boolean status.
+ * @returns The pool emptiness status.
*/
protected get empty (): boolean {
return this.minimumNumberOfWorkers === 0 && this.workerNodes.length === 0
/**
* Whether the pool is full or not.
- *
- * The pool filling boolean status.
+ * @returns The pool filling boolean status.
*/
protected get full (): boolean {
return (
/**
* The priority queue size.
+ * @returns The priority queue size.
*/
public get size (): number {
let node: PriorityQueueNode<T> | undefined = this.tail
/**
* The number of filled prioritized buckets.
+ * @returns The number of filled prioritized buckets.
*/
public get buckets (): number {
return Math.trunc(this.size / this.bucketSize)
/**
*
* @param data
+ * @returns
*/
async function error (data) {
return sleepTaskFunction(
/**
*
* @param data
+ * @returns
*/
async function sleep (data) {
return sleepTaskFunction(data, 50000)
/**
*
* @param data
+ * @returns
*/
async function sleep (data) {
return sleepTaskFunction(data, 50000)
/**
*
* @param data
+ * @returns
*/
function test (data) {
data = data || {}