<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans">
    <title>canxin&#x27;s blog - ChatGPT</title>
    <subtitle>canxin 的博客</subtitle>
    <link rel="self" type="application/atom+xml" href="https://blog.cxits.cn/tags/chatgpt/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://blog.cxits.cn"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-08-21T00:00:00+00:00</updated>
    <id>https://blog.cxits.cn/tags/chatgpt/atom.xml</id>
    <entry xml:lang="zh-Hans">
        <title>ChatGPT 长会话卡顿的修复：ChatGPT Performance Fix 使用说明</title>
        <published>2026-08-21T00:00:00+00:00</published>
        <updated>2026-08-21T00:00:00+00:00</updated>
        
        <author>
          <name>
            canxin
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://blog.cxits.cn/blog/chatgpt-performance-fix/"/>
        <id>https://blog.cxits.cn/blog/chatgpt-performance-fix/</id>
        
        <content type="html" xml:base="https://blog.cxits.cn/blog/chatgpt-performance-fix/">&lt;p&gt;ChatGPT 的长会话在消息数量增加、工具调用变多，或回复里包含大量代码块时，常见现象是打开变慢、向上滚动卡顿，甚至页面短时间失去响应。&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ChatGPT Performance Fix&lt;&#x2F;code&gt; 是一个 Tampermonkey 用户脚本，针对这类长会话的加载和渲染过程做了优化。核心思路不是修改服务器上的会话内容，而是减少浏览器一次性接收、解析和渲染的数据量。&lt;&#x2F;p&gt;
&lt;h2 id=&quot;an-zhuang&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#an-zhuang&quot; aria-label=&quot;Anchor link for: an-zhuang&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
安装&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;安装 &lt;a class=&quot;external&quot; rel=&quot;noopener nofollow noreferrer external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.tampermonkey.net&#x2F;&quot;&gt;Tampermonkey&lt;&#x2F;a&gt;。&lt;&#x2F;li&gt;
&lt;li&gt;打开&lt;a class=&quot;external&quot; rel=&quot;noopener nofollow noreferrer external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;canxin121&#x2F;chatgpt-web-performance-fix&#x2F;main&#x2F;dist&#x2F;chatgpt-performance-fix.user.js&quot;&gt;一键安装 ChatGPT Performance Fix&lt;&#x2F;a&gt;。&lt;&#x2F;li&gt;
&lt;li&gt;在 Tampermonkey 的安装页面确认脚本。&lt;&#x2F;li&gt;
&lt;li&gt;刷新 &lt;a class=&quot;external&quot; rel=&quot;noopener nofollow noreferrer external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;chatgpt.com&#x2F;&quot;&gt;ChatGPT&lt;&#x2F;a&gt;，脚本即可生效。&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;shi-yong-fang-shi&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#shi-yong-fang-shi&quot; aria-label=&quot;Anchor link for: shi-yong-fang-shi&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
使用方式&lt;&#x2F;h2&gt;
&lt;p&gt;安装完成后，日常使用方式不变。打开长会话时，默认只渲染最近 2 轮对话；需要查看更早内容时，页面顶部会出现历史控制条。&lt;&#x2F;p&gt;
&lt;p&gt;历史控制条支持以下操作：&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;选择每次加载的历史数量：&lt;code&gt;1 &#x2F; 2 &#x2F; 5 &#x2F; 10 &#x2F; 20 &#x2F; 50&lt;&#x2F;code&gt; 轮。&lt;&#x2F;li&gt;
&lt;li&gt;选择“自定义”填写加载数量。&lt;&#x2F;li&gt;
&lt;li&gt;点击“加载 N 轮”手动读取更早消息。&lt;&#x2F;li&gt;
&lt;li&gt;点击“全部加载”恢复完整历史加载方式。&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Tampermonkey 菜单还提供几个设置项：&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;默认打开：N 轮 &#x2F; 全部&lt;&#x2F;strong&gt;：设置打开会话时的初始历史数量。&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;历史批量：N 轮 &#x2F; 全部&lt;&#x2F;strong&gt;：设置手动加载历史时的默认批量。&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;切换模式&lt;&#x2F;strong&gt;：支持 &lt;code&gt;balanced&lt;&#x2F;code&gt;、&lt;code&gt;aggressive&lt;&#x2F;code&gt; 和 &lt;code&gt;off&lt;&#x2F;code&gt;。&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;隐藏&#x2F;显示消息时间与模型&lt;&#x2F;strong&gt;：切换消息下方的元信息徽标。&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;默认使用 &lt;code&gt;balanced&lt;&#x2F;code&gt; 模式。页面卡顿仍然明显时，可以切换到 &lt;code&gt;aggressive&lt;&#x2F;code&gt;；需要恢复 ChatGPT 原始行为时，可以切换到 &lt;code&gt;off&lt;&#x2F;code&gt;。&lt;&#x2F;p&gt;
&lt;h2 id=&quot;gua-he-shen-me-chang-jing&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#gua-he-shen-me-chang-jing&quot; aria-label=&quot;Anchor link for: gua-he-shen-me-chang-jing&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
适合什么场景&lt;&#x2F;h2&gt;
&lt;p&gt;这个脚本主要适合以下情况：&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;单个会话持续使用很久，历史消息数量较多。&lt;&#x2F;li&gt;
&lt;li&gt;会话包含大量工具调用、代码执行结果或内部结构消息。&lt;&#x2F;li&gt;
&lt;li&gt;回复中包含很多代码块、表格或复杂 Markdown。&lt;&#x2F;li&gt;
&lt;li&gt;打开会话时页面长时间空白，向上滚动时出现明显停顿。&lt;&#x2F;li&gt;
&lt;li&gt;浏览器标签页的 CPU 占用和内存占用持续偏高。&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;普通短会话的数据量较小，优化前后的差异通常不明显。&lt;&#x2F;p&gt;
&lt;h2 id=&quot;yuan-lai-de-qia-dun-lai-zi-na-li&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#yuan-lai-de-qia-dun-lai-zi-na-li&quot; aria-label=&quot;Anchor link for: yuan-lai-de-qia-dun-lai-zi-na-li&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
原来的卡顿来自哪里&lt;&#x2F;h2&gt;
&lt;p&gt;ChatGPT 原本可能在打开会话时请求一整棵历史消息树。一次旧版响应包含约 11 MB JSON 和 5,405 个 mapping 节点，其中还包括大量工具调用、工具返回、隐藏消息和未使用的历史分支。&lt;&#x2F;p&gt;
&lt;p&gt;这些内容返回浏览器后，还需要经过 JSON 解析、会话树构建、React 组件提交、Markdown 渲染、代码块初始化和浏览器布局。消息区与侧边栏共享同一个主线程，任意一处长时间执行都会让整个页面一起卡住。&lt;&#x2F;p&gt;
&lt;p&gt;向上滚动加载历史时，旧流程还会把整页消息一次性插入 DOM，并立即读取新的 &lt;code&gt;scrollHeight&lt;&#x2F;code&gt; 来修正滚动位置。这会强制浏览器同步完成 React 提交、样式计算和布局，历史页越大，停顿越明显。&lt;&#x2F;p&gt;
&lt;p&gt;另外，流式 Markdown 和代码块原本会通过高频动画逐步更新内容，大量代码块还会分别创建尺寸观察器和代码编辑器实例。几十个重型富文本节点同时恢复时，布局和绘制压力会集中出现。&lt;&#x2F;p&gt;
&lt;h2 id=&quot;xiu-fu-fang-shi&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#xiu-fu-fang-shi&quot; aria-label=&quot;Anchor link for: xiu-fu-fang-shi&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
修复方式&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;shou-ci-da-kai-gai-wei-an-xu-fen-ye&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#shou-ci-da-kai-gai-wei-an-xu-fen-ye&quot; aria-label=&quot;Anchor link for: shou-ci-da-kai-gai-wei-an-xu-fen-ye&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
首次打开改为按需分页&lt;&#x2F;h3&gt;
&lt;p&gt;脚本会优先使用 ChatGPT 自己的分页接口，以最近 2 轮作为初始窗口，并保留服务器返回的历史 cursor。更早的消息不会在打开时全部渲染，只有点击历史控制条后才继续加载。&lt;&#x2F;p&gt;
&lt;p&gt;这样可以把“打开会话”从一次全量处理，改成“先显示最近内容，再按需读取历史”。分页过程仍然使用 ChatGPT 原有的数据结构，不会改变服务器上的会话。&lt;&#x2F;p&gt;
&lt;h3 id=&quot;jian-rong-jiu-ban-quan-liang-jie-kou&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#jian-rong-jiu-ban-quan-liang-jie-kou&quot; aria-label=&quot;Anchor link for: jian-rong-jiu-ban-quan-liang-jie-kou&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
兼容旧版全量接口&lt;&#x2F;h3&gt;
&lt;p&gt;部分页面或特殊会话仍可能走旧版全量接口。遇到这种情况，脚本会在数据交给页面之前压缩浏览器副本：&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;沿当前活动分支保留有效消息。&lt;&#x2F;li&gt;
&lt;li&gt;历史回合主要保留用户消息和最终回复。&lt;&#x2F;li&gt;
&lt;li&gt;删除不需要显示的旧工具调用、工具结果和隐藏节点。&lt;&#x2F;li&gt;
&lt;li&gt;保留当前节点及必要的父节点，避免影响会话继续生成。&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;服务器原始数据不会被删除，压缩只发生在当前页面的内存数据上。&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ba-zhong-shu-ju-chu-li-yi-chu-zhu-xian-cheng&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#ba-zhong-shu-ju-chu-li-yi-chu-zhu-xian-cheng&quot; aria-label=&quot;Anchor link for: ba-zhong-shu-ju-chu-li-yi-chu-zhu-xian-cheng&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
把重数据处理移出主线程&lt;&#x2F;h3&gt;
&lt;p&gt;JSON 解析、分页响应合并和历史消息优化放在 Web Worker 中执行。页面主线程只负责接收整理后的结果，减少大段数据解析时对滚动和输入操作的阻塞。&lt;&#x2F;p&gt;
&lt;p&gt;已完成且空闲的会话响应还会保存在当前页面的内存快照中。后续相同读取优先使用快照，不额外进行后台轮询；正在生成或状态不明确的会话不会被长期缓存。&lt;&#x2F;p&gt;
&lt;h3 id=&quot;jiang-di-fu-wen-ben-he-dai-ma-kuai-de-ji-zhong-xuan-ran-ya-li&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#jiang-di-fu-wen-ben-he-dai-ma-kuai-de-ji-zhong-xuan-ran-ya-li&quot; aria-label=&quot;Anchor link for: jiang-di-fu-wen-ben-he-dai-ma-kuai-de-ji-zhong-xuan-ran-ya-li&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
降低富文本和代码块的集中渲染压力&lt;&#x2F;h3&gt;
&lt;p&gt;脚本针对 ChatGPT 的重型富文本组件做了几层处理：&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;跳过高频的逐字符 Markdown 平滑渲染。&lt;&#x2F;li&gt;
&lt;li&gt;取消代码块从零高度展开的动画，避免先出现大量空白横条。&lt;&#x2F;li&gt;
&lt;li&gt;跳过特定平滑代码块的重复 &lt;code&gt;ResizeObserver&lt;&#x2F;code&gt; 测量。&lt;&#x2F;li&gt;
&lt;li&gt;对代码块、表格、KaTeX 和预览区域分级预热，靠近视口的内容优先恢复。&lt;&#x2F;li&gt;
&lt;li&gt;CodeMirror 代码编辑器只在接近可视区域时初始化，避免打开页面时一次创建几十个编辑器实例。&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;这些处理减少的是布局、测量和绘制峰值，普通文本和已经位于视口中的内容仍然保持正常显示。&lt;&#x2F;p&gt;
&lt;h2 id=&quot;xiang-mu-di-zhi&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#xiang-mu-di-zhi&quot; aria-label=&quot;Anchor link for: xiang-mu-di-zhi&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;&lt;&#x2F;a&gt;
项目地址&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;noopener nofollow noreferrer external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;canxin121&#x2F;chatgpt-web-performance-fix&quot;&gt;GitHub 仓库&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;noopener nofollow noreferrer external&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;canxin121&#x2F;chatgpt-web-performance-fix&#x2F;main&#x2F;dist&#x2F;chatgpt-performance-fix.user.js&quot;&gt;一键安装脚本&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;脚本默认使用 &lt;code&gt;balanced&lt;&#x2F;code&gt; 模式，适合大多数长会话。ChatGPT 页面结构变化后，脚本可能需要同步更新；遇到兼容性问题时，可以先切换到 &lt;code&gt;off&lt;&#x2F;code&gt; 模式恢复原始行为。&lt;&#x2F;p&gt;
</content>
        
    </entry>
</feed>
