From cb0622168eef718475396851e66a9c19a3039630 Mon Sep 17 00:00:00 2001 From: anyulled <100741+anyulled@users.noreply.github.com> Date: Sun, 5 Apr 2026 08:23:31 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Optimize=20array=20spre?= =?UTF-8?q?ad=20to=20amortized=20O(1)=20push=20in=20schedule=20hook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaced array spread syntax `[...existing, session]` with `existing.push(session)` inside the `forEach` loop in `getSchedule`. This prevents O(N^2) memory reallocation during parsing. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- hooks/useSchedule.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hooks/useSchedule.ts b/hooks/useSchedule.ts index db5a713..b03a06d 100644 --- a/hooks/useSchedule.ts +++ b/hooks/useSchedule.ts @@ -59,8 +59,14 @@ export const getSchedule = cache(async (year: string | number): Promise { room.sessions.forEach((session) => { const timeKey = format(parseISO(session.startsAt), "HH:mm"); - const existing = sessionsByTime.get(timeKey) || []; - sessionsByTime.set(timeKey, [...existing, session]); + const existing = sessionsByTime.get(timeKey); + if (!existing) { + sessionsByTime.set(timeKey, [session]); + } else { + // ⚡ Bolt: Use amortized O(1) push instead of O(N^2) array spread inside loop + // Impact: Decreases memory consumption and GC pauses for large schedule datasets + existing.push(session); + } }); }); From 27b2cb604b3246e3d0bf893b2ae7f7faf1f39761 Mon Sep 17 00:00:00 2001 From: anyulled <100741+anyulled@users.noreply.github.com> Date: Sun, 5 Apr 2026 08:27:11 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Optimize=20array=20spre?= =?UTF-8?q?ad=20to=20amortized=20O(1)=20push=20in=20schedule=20hook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaced array spread syntax `[...existing, session]` with `existing.push(session)` inside the `forEach` loop in `getSchedule`. This prevents O(N^2) memory reallocation during parsing. Fixes consecutive line comments ESLint issue. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- hooks/useSchedule.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hooks/useSchedule.ts b/hooks/useSchedule.ts index b03a06d..9486d97 100644 --- a/hooks/useSchedule.ts +++ b/hooks/useSchedule.ts @@ -63,8 +63,10 @@ export const getSchedule = cache(async (year: string | number): Promise