perf(web): reuse completed Markdown prefixes while streaming #11193
Mergedjuliusmarmingemerged 3 commits into
legend-perf/timeline-updates fromrefs/pull/11193/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/web/src/markdown-incremental.ts line 95OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +75,21 @@75+ cached = {76+ source: source.slice(0, offset),77+ offset,78+ line: node.position!.end.line + 2,79+ children: structuredClone(root.children.slice(0, index + 1)),80+ };81+ break;82+ }83+ return root;84+ };85+}86+87+/** One cache per streaming renderer. Extra syntax plugins must use the normal88+ * parser because their document-wide dependencies are not known here.89+ */90+export function createIncrementalMarkdownPlugin(): Plugin<[], Root> {91+ let parser: Parser | undefined;92+ return function () {93+ const original = this.parser;94+ if (!original) return;95+ parser ??= createIncrementalMarkdownParser((source, file) => original(source, file) as Root);
github-actions[bot](GitHub profile, opens in a new tab) added labels📱 Native Change
github-actions[bot](GitHub profile, opens in a new tab) removed labels📱 Native Change
juliusmarminge merged thisa9dabbf
juliusmarminge closed this
Sign in to join this conversation.


Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result:
a660ad9· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.