Repository navigation
refactor: Allocate less in parseTwitchEmotes - #7187
Merged
Merged
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
pajlada
approved these changes
Aug 22, 2026
pajlada
enabled auto-merge (squash)
August 22, 2026 11:00
invisibl3cat
pushed a commit
to invisibl3cat/chatterino2
that referenced
this pull request
Aug 23, 2026
`parseTwitchEmotes` and `appendTwitchEmoteOccurrences` do some string parsing. Notably they split the emote range strings (`<emote-id>:<ranges...>/<emote-id>:...`) into owned `QString`s. They don't have to do that. This PR moves the parsing from using `QString`s to `QStringView`s and using `tokenize` (lazy split) and `splitOnce`. Furthermore, the message indices are now stack-allocated if possible and use 16 bits (enough for Twitch messages). Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
babicekmarek
pushed a commit
to babicekmarek/streamally-chatterino
that referenced
this pull request
Sep 14, 2026
`parseTwitchEmotes` and `appendTwitchEmoteOccurrences` do some string parsing. Notably they split the emote range strings (`<emote-id>:<ranges...>/<emote-id>:...`) into owned `QString`s. They don't have to do that. This PR moves the parsing from using `QString`s to `QStringView`s and using `tokenize` (lazy split) and `splitOnce`. Furthermore, the message indices are now stack-allocated if possible and use 16 bits (enough for Twitch messages). Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
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.
parseTwitchEmotesandappendTwitchEmoteOccurrencesdo some string parsing. Notably they split the emote range strings (<emote-id>:<ranges...>/<emote-id>:...) into ownedQStrings. They don't have to do that.This PR moves the parsing from using
QStrings toQStringViews and usingtokenize(lazy split) andsplitOnce. Furthermore, the message indices are now stack-allocated if possible and use 16 bits (enough for Twitch messages).One might think of a further optimization: Storing only the emote ID in
TwitchEmoteOccurrenceand resolving the part in the message later. But we do need the name for processing ignore phrases.