OpenCode issue profiles streaming bottleneck: every delta DOM-round-trips the whole markdown block

Te-River · ghdev · 2026-10-11

A reproduced OpenCode desktop issue dissects the streaming render bottleneck: each streaming delta costs 2ms of main-thread time, and the dominant cost is not the store walk but the HTML re-parse and DOM round-trip of the whole markdown block.

Author Te-River profiled 600 visible deltas across 8 parallel streaming sessions with CDP and sourcemaps (production build, 2880ms sampled self time):

The hot path in markdown.tsx does a full round-trip per delta: innerHTML parse of the whole block → multiple DOM walks marking inline code/links → serialize back to a string → parseMarkdownNodes again. The actual parse is only 2.4%; the cost lives in the DOM trip around it. The store walk is being halved in PR #54427, but the author notes it isn't the dominant cost.

Original post →

More from coding & agent

coding & agent channel →