perf(app): replace react-markdown with Streamdown (PoC) - #1317
Open
smsunarto wants to merge 2 commits into
Open
Conversation
smsunarto
marked this pull request as ready for review
August 11, 2026 05:17
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.
Note: this is more of a PoC than anything -- I realize this whole system is pretty integral and wired together to a lot of things, so I can't say with confidence that this PR is mergeable. The goal here is to demonstrate 1) feasability and 2) perf gain is there.
Also, I'll add that it's likely most ideal in the long run to move all markdown rendering to Streamdown to avoid the additional bundle size overhead from 2 markdown renderers.
Summary
react-markdownwith Streamdown while preserving BB's custom Markdown components, directives, mentions, raw HTML policy, and local-file routingPerformance evidence
Measured in the real source-built BB app with React Scan 0.5.7 and React Profiler enabled. Both runs used the same prompt and rendered 25 level-two headings, 25 lists, and 50 paragraphs. The Streamdown response was 8.1% longer, so render work per KiB is the fairest comparison.
All benchmark numbers from MBP M5 Max -- numbers are likely to differ in other devices esp. mobile which should be much worse.
Streamdown produced more commits (393 versus 134) because it updates smaller blocks; the individual commits were much cheaper. React Scan adds overhead, so these are instrumented component timings rather than clean frame-rate measurements. Model and network time are excluded from renderer conclusions.
Recordings
See below recordings of the re-renders with React Scan enabled to visualize component renders more clearly.
Before: react-markdown
pr-before-react-markdown.mp4
After: Streamdown
pr-after-streamdown.mp4
Test plan
pnpm exec turbo run test --filter=@bb/app --force— 331 files and 2,524 tests passedpnpm exec turbo run typecheck --filter=@bb/app --forcepnpm exec turbo run build --filter=@bb/app --forcenode apps/app/scripts/check-bundle-budget.mjs— 431.0 KB Brotli boot payload against a 435.3 KB budgetNotes
file:links remain allowed only after BB's workspace containment checks