From cb50e91315b50f30542482fa980f989a9c7227dd Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 7 Feb 2026 22:39:51 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Optimize=20balance=20iteration=20to?= =?UTF-8?q?=20avoid=20intermediate=20array=20allocation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: PixelMelt <44953835+PixelMelt@users.noreply.github.com> --- src/bot.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/bot.js b/src/bot.js index 4b15a22..c013ae8 100644 --- a/src/bot.js +++ b/src/bot.js @@ -816,12 +816,15 @@ class BonkBot { tea: this.room.teams || false, ga: "b", mo: "b", - bal: this.getAllPlayers().reduce((balances, player) => { - if (player.balance) { - balances[player.id] = player.balance; + bal: (() => { + const balances = {}; + for (const player of this.players.values()) { + if (player.balance) { + balances[player.id] = player.balance; + } } return balances; - }, {}) + })() } }); }