Repository navigation
Conversation
A long reply paragraph with many plain markers (snake_case names, stray brackets) froze the app while its row composed. InlineText.coalesced copied the whole merged string for every run it merged, and each stray ] appended to the previous text node the same way, so the cost grew with the square of the paragraph's size: 352 KB of snake_case text took 1.4 s to parse on the dev VM. Merged text now goes through one StringBuilder, and a ] that doesn't close a link stays in the text buffer. Verified: two new MarkdownBlockTests cases (200,000 runs; 150,000 stray ]) time out at 2 s without the fix and pass with it; the same snake_case text now parses in 14 ms. Full scripts/check.sh passes. Not reproduced as an ANR on a device. Part of #278
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.
The app froze ("isn't responding") while showing a reply with a very long paragraph full of plain markers, like snake_case names or stray brackets. Merging the parsed pieces of a paragraph copied the whole merged text again for every piece, and each stray
]did the same to the text before it, so the work grew with the square of the paragraph's length: 352 KB of snake_case text took 1.4 s on the dev VM, and much longer on a phone.Now merged text is built once with a
StringBuilder, and a]that doesn't close a link stays in the text buffer; the same text parses in 14 ms. Nothing visible changes.MarkdownBlockTestscases (many adjacent runs, many stray]) time out at 2 s ondevand pass with the fix. Fullscripts/check.shpasses.Part of #278