What it does
Long AI conversations pile up thousands of DOM nodes, huge syntax-highlighted code blocks, Markdown tables, shadows, and blur layers. Eventually, opening or scrolling a thread starts stuttering, the browser tab burns CPU/GPU, and typing in a long chat (especially on Google AI Studio or Gemini) drops to 2–3 FPS — letters appear seconds after you press the keys.
AI OptiChat applies lightweight styles at document-body and removes rendering bottlenecks from the very first frame without breaking chat buttons, message collapsing, or page layout.
Installation
- Install a userscript manager such as Tampermonkey or Violentmonkey.
- Click to install: Install AI OptiChat
Updates are delivered automatically from GitHub Releases.
Features
Settings are split into per-site options (saved independently for each domain) and global options (synced across all sites and open tabs).
Per-Site Settings
- Skip off-screen messages – When a long chat freezes while opening or jerks while scrolling, the browser is recalculating layout for hundreds of old messages far above the screen. Applies
content-visibility: auto to off-screen turns from the first frame so the browser skips rendering them until you scroll back.
- Pre-render nearby turns – Prevents sudden scroll jumps and broken interactive buttons when off-screen skipping is active. Uses an
IntersectionObserver with an 800px margin around your viewport (plus :focus-within protection when interacting with code blocks) to prepare adjacent messages smoothly.
- Optimize code & tables – Massive AI responses packed with code blocks and large Markdown tables slow down rendering even in smaller threads. Defers layout and painting for
<pre> and <table> blocks outside the visible area.
- Isolate message layout – Applies
contain: layout style to message turns so live token streaming at the bottom of a thread does not trigger expensive layout reflows across neighboring messages.
- Smooth typing – Fixes the 2–3 FPS typing lag in huge chats, where every single keystroke triggers a heavy page re-render and characters appear with a painful delay. Intercepts and batches rapid
<textarea> input events with a configurable preset slider (120 / 180 / 240 / 320 / 400 ms, default 240 ms with 1-click reset).
- Disable spellcheck – Sets
spellcheck="false" on chat inputs so the browser stops running live spellchecking and underline recalculations on long prompts.
Global Settings
- Remove background blur – Disables expensive
backdrop-filter blur on floating panels and overlays outside messages, cutting GPU load on integrated graphics and high-DPI displays.
- Disable animations – Reduces decorative CSS transitions and animations inside messages to
0.001ms so elements respond immediately without breaking collapse/expand behavior.
- Remove shadows – Strips
box-shadow and text-shadow from message cards, making scrolling lighter without affecting buttons or layout.
- Compact long code – Caps tall
<pre> code blocks at 460px with an internal scrollbar so huge code outputs don’t stretch the thread or cause massive layout shifts.
- Lazy-load images – Marks images in older messages with
loading="lazy" and decoding="async" so off-screen pictures are only loaded and decoded when you scroll near them.
- Auto-activate threshold – Keep optimizations always on (
0), or set a message threshold (1–1000) so short chats stay untouched and optimizations engage automatically only when a conversation grows large.
- Adaptive theme – Automatically matches the active site’s dark or light theme (reacting to live theme switches) or can be manually locked to Dark / Light.
- Floating widget – Compact control pill that can be collapsed into Mini mode (a subtle dot), Unlocked to drag anywhere on screen, or Disabled completely for a specific site.
- Multi-language & Cross-tab sync – Automatically matches your browser language (with instant manual switching in the header) and syncs global settings, theme, and widget state across all open tabs.

评论