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):
- 32.8% (943.5ms): native (program) — HTML parse, style, layout
- 18.6% (536.5ms): solid-js/store unwrap, with each tree walked twice per delta
- 13.3%: idle time waiting on the markdown worker
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.
More from coding & agent
- OpenJet claims Qwen3.8-27B coding runs 1.9x faster than llama.cpp on one RTX 3090 — JeremyCMorgan · 2026-10-23
- Building an autonomous SEO agent in Hermes with three skills: programmatic pages, Keywords Everywhere, DataForSEO — EXM7777 · 2026-10-23
- Building a sports betting AI agent with onchain execution and human approval by default: architecture and lessons — Dry-Comfortable-2678 · 2026-10-23
- Capy 0.5.0 lets Claude Pro/Max subscribers reuse their plan quota, adds OIDC cloud access — garrytan · 2026-10-23
- You.com CEO Richard Socher: legacy code is human slop, let AI clean it up — RichardSocher · 2026-10-23
- Let agents design a single-line glance component so you can track them from the sidebar — blixt · 2026-10-23