From 70201947a92e3f52b5a7dae2c3d2350945011770 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 02:48:39 +0000 Subject: [PATCH] perf: optimize array creation in Hologram components Moves static array creation out of component render functions in Hologram.tsx to prevent unnecessary recreation on every frame. Co-authored-by: pavan721 <88892612+pavan721@users.noreply.github.com> --- src/components/3d/Hologram.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/3d/Hologram.tsx b/src/components/3d/Hologram.tsx index 1920790..cf1658a 100644 --- a/src/components/3d/Hologram.tsx +++ b/src/components/3d/Hologram.tsx @@ -38,6 +38,8 @@ function ArcCore({ isSpeaking, isProcessing }: { isSpeaking: boolean; isProcessi ) } +const COILS_ARRAY = Array.from({ length: 10 }) + function ArcRings({ isSpeaking, isProcessing }: { isSpeaking: boolean; isProcessing: boolean }) { const groupRef = useRef(null) @@ -62,7 +64,7 @@ function ArcRings({ isSpeaking, isProcessing }: { isSpeaking: boolean; isProcess {/* Segmented coils */} - {Array.from({ length: 10 }).map((_, i) => ( + {COILS_ARRAY.map((_, i) => ( @@ -77,6 +79,8 @@ function ArcRings({ isSpeaking, isProcessing }: { isSpeaking: boolean; isProcess ) } +const STRUTS_ARRAY = Array.from({ length: 3 }) + function ArcCasing() { const groupRef = useRef(null) @@ -94,7 +98,7 @@ function ArcCasing() { {/* Casing details / struts */} - {Array.from({ length: 3 }).map((_, i) => ( + {STRUTS_ARRAY.map((_, i) => (