Repository navigation
perf(web): reuse unchanged Markdown during streaming - #435
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Closes #434. During live output, Transcript rebuilds row elements and reparses unchanged historical Markdown. A real Transcript regression at main
5262158records 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
bun run check: passed.bun run test: 1,442 Node tests passed, one platform skip; 82 Vitest tests passed.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.