Repository navigation
Conversation
The reactive `shown` validation previously checked `tokens.map(l => l.map(t => t.content).join('')).join('\n') === code` on every re-render. Since `code` updates frequently during chat streaming, this deep nested stringification created massive intermediate array allocations and GC overhead.
This replaces the functional approach with a `useMemo` block encapsulating standard `for` loop iteration and manual string concatenation, eliminating the intermediate array objects and improving UI responsiveness during streaming.
Co-authored-by: bobdivx <6737167+bobdivx@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Understood. Acknowledging that this work is now obsolete and stopping work on this task. |
💡 What: Replaced functional string array concatenation (
tokens.map(...).join(...)) inCodeBlock.tsxwith auseMemohook enclosing nestedforloops.🎯 Why: During chat streaming, the CodeBlock component re-renders rapidly as the
codestring grows. Deep.map().join()execution on each render cycle allocates many intermediate arrays, triggering GC sweeps and dropping frames.📊 Impact: Considerably reduces garbage collector pressure on large code blocks during the chat streaming phase, minimizing FPS drops.
🔬 Measurement: Verify by streaming a long block of text/code into the chat UI and profiling React component render times and JS heap size. Web tests have been ran and passed locally.
PR created automatically by Jules for task 10399210196771324435 started by @bobdivx