Skip to content

Web transcript still re-renders the whole history row tree on each streaming update #872

Closed as not planned

Description

@cursor

总跟踪:#841。跟进 #837 与 #870。

#870 去掉了流式 message_update 上整段持久历史的签名与 thinking 时间表复制,Bun 计数已经不再随历史字节增长。同一套 headless Chrome 测量里,提交耗时和输入到帧的时间没有下降:每次流式更新仍然重渲染整棵历史行树。

测量

环境与 #870 的浏览器证据相同:系统 Chrome,视口 1280×800,Vite dev,真实 Transcript。每条历史消息在 content 和一个 text part 里各有 1000 个 x。1000 条历史。Before 是 78dc574,After 是 #870。每页 20 次各自成任务的流式更新,再加 12 次输入事件(每次再应用一次更新并等到下一帧)。指标是 React Profiler actualDuration、PerformanceObserver longtask,以及 input-to-frame。

页面 #870 之前 #870 之后
1000 条 33 commits,actualDuration 中位 166.9 ms(最大 319.3,合计 6427),32 long tasks / 9278 ms(最大 1389),input-to-frame 中位 229.2 ms(最大 375) 33 commits,中位 177.3 ms(最大 317.2,合计 6637),32 long tasks / 9781 ms(最大 1499),input-to-frame 中位 217.6 ms(最大 377)

流式更新的提交中位仍约 170 ms,input-to-frame 仍约 220 ms。签名工作已经被 Bun 计数隔离掉了;剩下的时间花在整棵历史行的 React 提交上。

期望

一次只改变正在生成的消息的流式更新,只重渲染那条 live 消息。未变化的历史行不重渲染(稳定 key、memo 的行、稳定 props)。滚动跟随、选中和查找保持原样。列表虚拟化只在 memo 本身不够时才考虑。

Refs #837、#870、#841。不替换 #434 的历史 Markdown memo。

Activity

  1. tt-a1i commented on Oct 16, 2026

    @tt-a1i
    Collaborator

    Closing #873 without merging. With the same browser harness, the ~170ms/220ms baseline didn't reproduce (the baseline was ~3–9ms commits). Memoizing rows helped at 1000 rows (~9ms → ~4.5ms) but regressed at 250 rows (~3ms → ~8ms), so it isn't worth the added complexity right now. Reopen with a reproducible measurement if this shows up in real use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions