Repository navigation
Cut per-chunk JS work while a reply streams - #4007
Closed
DoodleBears wants to merge 3 commits into
Closed
DoodleBears wants to merge 3 commits into
DoodleBears wants to merge 3 commits into
Conversation
text-playback rebuilt its grapheme end list with filter, spread and findIndex on every update, which is O(n²) over a long reply. Truncate in place and binary-search the cursor instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lpx6qkP973FGPmahjst8nu
Pre-merge checks:
|
PressableBubble passed a fresh closure to MediaLongPress on every render, so each streamed tick changed the context value and React propagated it through the whole bubble subtree. Provide a stable function that calls the latest handler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lpx6qkP973FGPmahjst8nu
Each streamed update went through a regex test plus noble's hexToBytes. Validate and decode the hex in one pass instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lpx6qkP973FGPmahjst8nu
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.
Why the change
This is round 5 of the iOS chat performance work for #3974. A JS profile of a streamed reply on an iPhone XS Max (281 chunks, 21.5k characters) had these items among its top costs. There is one commit per item, so each one can be A/B tested on the device in sequence.
text-playback.tsrebuilt its grapheme end list withfilter, a spread andfindIndex, which is O(n²) over a long reply. It now truncates in place and binary-searches the cursor.propagateParentContextChangestook about 305 ms.PressableBubblepassed a fresh closure toMediaLongPress.Provideron every render, so each 32 ms playback tick changed a context value and React propagated it through the streaming bubble's subtree. The bubble now provides a stable function that calls the latest handler.hexToBytestook about 170 ms. Encrypted channel frames are now validated and decoded in one lookup-table pass, with the same rejection rules: lowercase hex only, odd length,hordprefix. In Node it is 3–4× faster on 281 frames.Special things to note
Change outline
apps/mobile/src/host/text-playback.tsapps/mobile/src/ui/chat/message-bubble.tsxpackages/core/src/devices/noise/channel.tschanges/ios-streaming-playback-scan.md🤖 Generated with Claude Code
https://claude.ai/code/session_01Lpx6qkP973FGPmahjst8nu