From bb615bd0adc6e3a7128e6a3826acf247ccd617e2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 3 Jun 2023 23:08:23 +0200 Subject: [PATCH] refactor: cleanup enums namespace MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- benchmarks/benchmarks-types.js | 8 +-- benchmarks/benchmarks-utils.js | 12 ++--- benchmarks/internal/bench.js | 96 +++++++++++++++++----------------- package.json | 2 +- pnpm-lock.yaml | 8 +-- tests/utils.test.js | 2 +- 6 files changed, 64 insertions(+), 64 deletions(-) diff --git a/benchmarks/benchmarks-types.js b/benchmarks/benchmarks-types.js index 7a951fee..4411fbbe 100644 --- a/benchmarks/benchmarks-types.js +++ b/benchmarks/benchmarks-types.js @@ -6,13 +6,13 @@ const WorkerFunctions = { } const PoolTypes = { - FIXED: 'fixed', - DYNAMIC: 'dynamic' + fixed: 'fixed', + dynamic: 'dynamic' } const WorkerTypes = { - THREAD: 'thread', - CLUSTER: 'cluster' + thread: 'thread', + cluster: 'cluster' } module.exports = { PoolTypes, WorkerFunctions, WorkerTypes } diff --git a/benchmarks/benchmarks-utils.js b/benchmarks/benchmarks-utils.js index 743936da..eb3a4f94 100644 --- a/benchmarks/benchmarks-utils.js +++ b/benchmarks/benchmarks-utils.js @@ -114,15 +114,15 @@ function executeWorkerFunction (data) { function buildPool (workerType, poolType, poolSize, poolOptions) { switch (poolType) { - case PoolTypes.FIXED: + case PoolTypes.fixed: switch (workerType) { - case WorkerTypes.THREAD: + case WorkerTypes.thread: return new FixedThreadPool( poolSize, './benchmarks/internal/thread-worker.js', poolOptions ) - case WorkerTypes.CLUSTER: + case WorkerTypes.cluster: return new FixedClusterPool( poolSize, './benchmarks/internal/cluster-worker.js', @@ -130,16 +130,16 @@ function buildPool (workerType, poolType, poolSize, poolOptions) { ) } break - case PoolTypes.DYNAMIC: + case PoolTypes.dynamic: switch (workerType) { - case WorkerTypes.THREAD: + case WorkerTypes.thread: return new DynamicThreadPool( poolSize / 2, poolSize * 3, './benchmarks/internal/thread-worker.js', poolOptions ) - case WorkerTypes.CLUSTER: + case WorkerTypes.cluster: return new DynamicClusterPool( poolSize / 2, poolSize * 3, diff --git a/benchmarks/internal/bench.js b/benchmarks/internal/bench.js index 94b49f13..627bd0ed 100644 --- a/benchmarks/internal/bench.js +++ b/benchmarks/internal/bench.js @@ -31,169 +31,169 @@ const workerChoiceStrategyFairSharePoolOption = { } const fixedThreadPoolRoundRobin = buildPool( - WorkerTypes.THREAD, - PoolTypes.FIXED, + WorkerTypes.thread, + PoolTypes.fixed, poolSize, workerChoiceStrategyRoundRobinPoolOption ) const fixedThreadPoolRoundRobinTasksQueue = buildPool( - WorkerTypes.THREAD, - PoolTypes.FIXED, + WorkerTypes.thread, + PoolTypes.fixed, poolSize, { ...workerChoiceStrategyRoundRobinPoolOption, ...tasksQueuePoolOption } ) const fixedThreadPoolLeastUsed = buildPool( - WorkerTypes.THREAD, - PoolTypes.FIXED, + WorkerTypes.thread, + PoolTypes.fixed, poolSize, workerChoiceStrategyLeastUsedPoolOption ) const fixedThreadPoolLeastBusy = buildPool( - WorkerTypes.THREAD, - PoolTypes.FIXED, + WorkerTypes.thread, + PoolTypes.fixed, poolSize, workerChoiceStrategyLeastBusyPoolOption ) const fixedThreadPoolWeightedRoundRobin = buildPool( - WorkerTypes.THREAD, - PoolTypes.FIXED, + WorkerTypes.thread, + PoolTypes.fixed, poolSize, workerChoiceStrategyWeightedRoundRobinPoolOption ) const fixedThreadPoolFairShare = buildPool( - WorkerTypes.THREAD, - PoolTypes.FIXED, + WorkerTypes.thread, + PoolTypes.fixed, poolSize, workerChoiceStrategyFairSharePoolOption ) const fixedThreadPoolFairShareTasksQueue = buildPool( - WorkerTypes.THREAD, - PoolTypes.FIXED, + WorkerTypes.thread, + PoolTypes.fixed, poolSize, { ...workerChoiceStrategyFairSharePoolOption, ...tasksQueuePoolOption } ) const dynamicThreadPoolRoundRobin = buildPool( - WorkerTypes.THREAD, - PoolTypes.DYNAMIC, + WorkerTypes.thread, + PoolTypes.dynamic, poolSize, workerChoiceStrategyRoundRobinPoolOption ) const dynamicThreadPoolLeastUsed = buildPool( - WorkerTypes.THREAD, - PoolTypes.DYNAMIC, + WorkerTypes.thread, + PoolTypes.dynamic, poolSize, workerChoiceStrategyLeastUsedPoolOption ) const dynamicThreadPoolLeastBusy = buildPool( - WorkerTypes.THREAD, - PoolTypes.DYNAMIC, + WorkerTypes.thread, + PoolTypes.dynamic, poolSize, workerChoiceStrategyLeastBusyPoolOption ) const dynamicThreadPoolWeightedRoundRobin = buildPool( - WorkerTypes.THREAD, - PoolTypes.DYNAMIC, + WorkerTypes.thread, + PoolTypes.dynamic, poolSize, workerChoiceStrategyWeightedRoundRobinPoolOption ) const dynamicThreadPoolFairShare = buildPool( - WorkerTypes.THREAD, - PoolTypes.DYNAMIC, + WorkerTypes.thread, + PoolTypes.dynamic, poolSize, workerChoiceStrategyFairSharePoolOption ) const fixedClusterPoolRoundRobin = buildPool( - WorkerTypes.CLUSTER, - PoolTypes.FIXED, + WorkerTypes.cluster, + PoolTypes.fixed, poolSize, workerChoiceStrategyRoundRobinPoolOption ) const fixedClusterPoolRoundRobinTasksQueue = buildPool( - WorkerTypes.CLUSTER, - PoolTypes.FIXED, + WorkerTypes.cluster, + PoolTypes.fixed, poolSize, { ...workerChoiceStrategyRoundRobinPoolOption, ...tasksQueuePoolOption } ) const fixedClusterPoolLeastUsed = buildPool( - WorkerTypes.CLUSTER, - PoolTypes.FIXED, + WorkerTypes.cluster, + PoolTypes.fixed, poolSize, workerChoiceStrategyLeastUsedPoolOption ) const fixedClusterPoolLeastBusy = buildPool( - WorkerTypes.CLUSTER, - PoolTypes.FIXED, + WorkerTypes.cluster, + PoolTypes.fixed, poolSize, workerChoiceStrategyLeastBusyPoolOption ) const fixedClusterPoolWeightedRoundRobin = buildPool( - WorkerTypes.CLUSTER, - PoolTypes.FIXED, + WorkerTypes.cluster, + PoolTypes.fixed, poolSize, workerChoiceStrategyWeightedRoundRobinPoolOption ) const fixedClusterPoolFairShare = buildPool( - WorkerTypes.CLUSTER, - PoolTypes.FIXED, + WorkerTypes.cluster, + PoolTypes.fixed, poolSize, workerChoiceStrategyFairSharePoolOption ) const fixedClusterPoolFairShareTaskQueue = buildPool( - WorkerTypes.CLUSTER, - PoolTypes.FIXED, + WorkerTypes.cluster, + PoolTypes.fixed, poolSize, { ...workerChoiceStrategyFairSharePoolOption, ...tasksQueuePoolOption } ) const dynamicClusterPoolRoundRobin = buildPool( - WorkerTypes.CLUSTER, - PoolTypes.DYNAMIC, + WorkerTypes.cluster, + PoolTypes.dynamic, poolSize, workerChoiceStrategyRoundRobinPoolOption ) const dynamicClusterPoolLeastUsed = buildPool( - WorkerTypes.CLUSTER, - PoolTypes.DYNAMIC, + WorkerTypes.cluster, + PoolTypes.dynamic, poolSize, workerChoiceStrategyLeastUsedPoolOption ) const dynamicClusterPoolLeastBusy = buildPool( - WorkerTypes.CLUSTER, - PoolTypes.DYNAMIC, + WorkerTypes.cluster, + PoolTypes.dynamic, poolSize, workerChoiceStrategyLeastBusyPoolOption ) const dynamicClusterPoolWeightedRoundRobin = buildPool( - WorkerTypes.CLUSTER, - PoolTypes.DYNAMIC, + WorkerTypes.cluster, + PoolTypes.dynamic, poolSize, workerChoiceStrategyWeightedRoundRobinPoolOption ) const dynamicClusterPoolFairShare = buildPool( - WorkerTypes.CLUSTER, - PoolTypes.DYNAMIC, + WorkerTypes.cluster, + PoolTypes.dynamic, poolSize, workerChoiceStrategyFairSharePoolOption ) diff --git a/package.json b/package.json index f31c5519..2d9f8dc0 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "eslint-define-config": "^1.20.0", "eslint-import-resolver-typescript": "^3.5.5", "eslint-plugin-import": "^2.27.5", - "eslint-plugin-jsdoc": "^46.2.0", + "eslint-plugin-jsdoc": "^46.2.1", "eslint-plugin-n": "^16.0.0", "eslint-plugin-promise": "^6.1.1", "eslint-plugin-spellcheck": "^0.0.20", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9af8e2a7..003afd75 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -57,8 +57,8 @@ devDependencies: specifier: ^2.27.5 version: 2.27.5(@typescript-eslint/parser@5.59.8)(eslint-import-resolver-typescript@3.5.5)(eslint@8.42.0) eslint-plugin-jsdoc: - specifier: ^46.2.0 - version: 46.2.0(eslint@8.42.0) + specifier: ^46.2.1 + version: 46.2.1(eslint@8.42.0) eslint-plugin-n: specifier: ^16.0.0 version: 16.0.0(eslint@8.42.0) @@ -2351,8 +2351,8 @@ packages: - supports-color dev: true - /eslint-plugin-jsdoc@46.2.0(eslint@8.42.0): - resolution: {integrity: sha512-Lo2Bs39UPtcvLGfBrI/RF+8mOPcYaHdj++YTfDrqrWHND2trGQBDKxCVcEyYACrQxyMYgpfqHkyxE0S184hOGg==} + /eslint-plugin-jsdoc@46.2.1(eslint@8.42.0): + resolution: {integrity: sha512-rsv3EE2FGDpYTSnIzDHpf9SsB7ccTmCl8dMcJzpBAOLiJ1maIMYMOfPDqT1IB+Y21muD894xhO6BTrOIvY5mfg==} engines: {node: '>=16'} peerDependencies: eslint: ^7.0.0 || ^8.0.0 diff --git a/tests/utils.test.js b/tests/utils.test.js index d4c2179b..b1a91776 100644 --- a/tests/utils.test.js +++ b/tests/utils.test.js @@ -6,7 +6,7 @@ const { } = require('../lib/worker/worker-options') describe('Utils test suite', () => { - it('Verify median computation', () => { + it('Verify median() computation', () => { expect(median([])).toBe(0) expect(median([0.08])).toBe(0.08) expect(median([0.25, 4.75, 3.05, 6.04, 1.01, 2.02, 5.03])).toBe(3.05) -- 2.34.1