From: Jérôme Benoit Date: Thu, 6 Apr 2023 06:53:39 +0000 (+0200) Subject: perf: remove unneeded nullish checks in hot code paths X-Git-Tag: v2.4.2~4 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=53cf34054602ef192d39c45ef257eddc0ae0fa97;p=poolifier.git perf: remove unneeded nullish checks in hot code paths Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/selection-strategies/less-used-worker-choice-strategy.ts b/src/pools/selection-strategies/less-used-worker-choice-strategy.ts index 01332caf..dffed99e 100644 --- a/src/pools/selection-strategies/less-used-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/less-used-worker-choice-strategy.ts @@ -31,7 +31,7 @@ export class LessUsedWorkerChoiceStrategy< let lessUsedWorkerKey!: number for (const [index, workerItem] of this.pool.workers.entries()) { const tasksUsage = workerItem.tasksUsage - const workerTasks = tasksUsage?.run + tasksUsage?.running + const workerTasks = tasksUsage.run + tasksUsage.running if (workerTasks === 0) { return index } else if (workerTasks < minNumberOfTasks) {