From ab85e6d7206a35df5dc45bf152bd7a6ea4ef4873 Mon Sep 17 00:00:00 2001 From: anyulled <100741+anyulled@users.noreply.github.com> Date: Tue, 31 Mar 2026 09:09:50 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9A=A1=20Bolt:=20O(1)=20scheduling=20acc?= =?UTF-8?q?umulator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaced O(N^2) array spread operations inside the useSchedule hook with an amortized O(1) push mutation to prevent excessive memory allocations. 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..0d97954 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) Array.prototype.push instead of O(N) array spread + // Eliminates O(N^2) time complexity and excess garbage collection in inner loop + existing.push(session); + } }); }); From bc37cf2636ceeab8cd00245434b0598853deb717 Mon Sep 17 00:00:00 2001 From: anyulled <100741+anyulled@users.noreply.github.com> Date: Tue, 31 Mar 2026 09:16:54 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9A=A1=20Bolt:=20O(1)=20scheduling=20acc?= =?UTF-8?q?umulator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaced O(N^2) array spread operations inside the useSchedule hook with an amortized O(1) push mutation to prevent excessive memory allocations. 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 0d97954..9363a63 100644 --- a/hooks/useSchedule.ts +++ b/hooks/useSchedule.ts @@ -63,8 +63,10 @@ export const getSchedule = cache(async (year: string | number): Promise