Repository navigation
perf(markdown): freeze settled section boundaries during streaming - #3801
Merged
wsp1911 merged 2 commits intoNov 14, 2026
Merged
Conversation
Merge main while preserving streaming cache isolation and normalized blank-line boundaries. Remove the unreachable no-parse fast path, keep conservative tail parsing, and cover incremental work and semantics. Focused tests: 19 passed. Web UI TypeScript check passed. check:web is blocked by the existing Dialog typography audit violation. AI-assisted follow-up for PR openBitFun#3801.
Closed
3 tasks done
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.
Summary
Streaming Markdown updates repeatedly tokenize the full document. This change reuses stable leading section boundaries and parses the remaining tail, retaining one section of lookbehind so the trailing block can change safely. Unchanged sections reuse their object identities.
main, preserving separate streaming/settled cache budgets and journal blank-line normalization.tailSource.length < SECTION_CHARSshortcut. Tail parsing is still required to detect new HTML, footnotes, and reference definitions that require whole-document rendering.The optimization needs at least three section boundaries to skip a nonempty prefix. Documents with only two boundaries still parse the full source; this does not claim constant-time updates or a no-tokenization fast path.
Validation
pnpm --dir src/web-ui exec tsc --noEmit): passed, reusing the checkout's existing generated API bindings.git diff --check: passed.pnpm run check:web: blocked by an existing main-branch typography audit violation indesign-system/packages/ui/src/components/Dialog/Dialog.module.css:77(--openbitfun-line-height-snug). That file and the audit script are unchanged from main.Local diagnostic benchmark: approximately 24K characters, 25 append operations per trial, 10 warm-up trials and 30 measured trials (750 samples per implementation). Compared with main, parser-function P50 changed from 0.0485 ms to 0.0228 ms and P95 from 0.0825 ms to 0.0363 ms. These are local Node/Vitest measurements, not native UI frame latency or CI thresholds.
No live Remote Workspace, Remote Control, Peer Device, or Detached Dispatch scenario was exercised; coverage is limited to the shared frontend parser. No protocol or persisted schema changes.
AI-assisted follow-up; locally tested at the parser and TypeScript level, with the broader Web check limitation noted above.