Bugfix & speed-up for ChatGPT: cleans the conversation chat window by trimming old messages from the Browser DOM. Keeps only the latest N turns visible, preventing lag and excessive DOM size on long sessions. Includes manual “Clean now” button and auto-clean toggle.
In long single-thread chats, the web UI gradually lags: typing slows down, scrolling stutters, sometimes the tab even freezes.
One reason is that the DOM keeps growing with all conversation turns. Large DOM trees are expensive to render and update, especially when streaming tokens.
React also stores its own internal message arrays (including telemetry and unfinished drafts), which keep piling up. But at the moment, trimming those is risky — too many side effects.
This userscript automatically trims old conversation turns from the DOM only, keeping only the most recent ones (default: 5).
By keeping the DOM short and clean, it reduces rendering overhead and makes the interface smoother, even in long chats.
chat.openai.com and chatgpt.com