Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request optimizes the terminal serialization process by eliminating unnecessary object creation and class instantiation within the main processing loop. By refactoring the logic to use primitive types for state tracking, the serialization becomes more efficient and less memory-intensive, while maintaining the same functional output. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
Hi @jacob314, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
|
Size Change: +67 B (0%) Total Size: 34.6 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request refactors the terminal serialization logic in packages/core/src/utils/terminalSerializer.ts by removing the Cell class and manual instance reuse in favor of a more direct, state-based approach for processing terminal cells. It also updates the test case in packages/core/src/utils/terminalSerializer.test.ts to include a newline character in the input string. I have no feedback to provide on these changes.
Resolves high volume object allocation during terminal serialization when rendering shell streams, by utilizing xterm.js pre-allocated `getNullCell()` to avoid allocating a new `IBufferCell` object on every character. This reverts the original attempt in #24485 and implements the correct xterm.js optimization pattern, which maintains the `Cell` class wrapper and avoids subtle logic regressions with inverted text/cursor bounds handling.
fac1966 to
42c94e6
Compare
|
|
||
| for (let x = 0; x < terminal.cols; x++) { | ||
| const cellData = line.getCell(x); | ||
| const cellData = line.getCell(x, cellBuffer); |
There was a problem hiding this comment.
subtle change that avoids allocating a new Cell object for ever O(rows x cols) chars in the terminal when streaming output from the shell.
Summary
The terminal serializer is called when streaming shell output.
It previously allocated a an object for every character which was inefficient and contributed to V8 memory pressure.
To mitigate, refactored the code to avoid any O(rows x cols) allocs every frame.