Skip to content

perf(web): reuse unchanged Markdown during streaming - #435

Merged
tt-a1i merged 1 commit into
mainfrom
codex/web-streaming-markdown
Sep 7, 2026
Merged

tt-a1i merged 1 commit into
mainfrom
codex/web-streaming-markdown

Conversation

@tt-a1i

@tt-a1i tt-a1i commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Closes #434. During live output, Transcript rebuilds row elements and reparses unchanged historical Markdown. A real Transcript regression at main 5262158 records 216 history parses for 24 replies plus eight stream updates, instead of only 24 initial parses.

Value

Remove unnecessary historical parsing as output streams, while continuing to render each changed live reply and historical correction. In this deterministic fixture total parser invocations fall from 225 to 33; this is not an end-to-end latency benchmark.

Approach

Wrap only the Markdown component with React's memo, using the existing string prop and default comparison. Keep Transcript, scrolling, sanitizer/plugins and link rendering intact. There is no global text cache or custom comparator. Rebuild the committed production bundle and preserve the investigation in the research record.

Validation

  • Regression first failed with 216 historical parser invocations versus 24 expected; passes after the fix. It mounts the real Transcript and delegates to the real react-markdown implementation, including live updates, cloned snapshots, historical corrections, Session switching and remounting.
  • bun run check: passed.
  • bun run test: 1,442 Node tests passed, one platform skip; 82 Vitest tests passed.
  • Production WebHost browser tests with local Chrome: 4 passed, including dark theme/cancellation, mobile/reduced-motion and axe coverage. The focused component suite retains explicit scrolling regression coverage.
  • Two independent final reviews: clean.
  • Final head 9530453572aa7e86960d5dc3dedef1c1ffda230c: Node 22.19.0/24/26, Windows and browser E2E all passed, including package/source install smokes: https://github.com/openpi-dev/openpi/actions/runs/34081375213.

Impact

User-visible content and interactions are preserved; unchanged mounted Markdown skips repeated parsing. Model-visible tools/context, execution lifecycle, permissions, persisted data, dependencies and configuration do not change. Changed text still reparses; unmount/remount can reparse as normal. List reconstruction and parsing the growing live response remain; no bundle-size or whole-page speedup claim is made.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Sep 7, 2026
@tt-a1i
tt-a1i merged commit 2d3f68b into main Sep 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(web): avoid reparsing unchanged history during streaming

1 participant