Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

refactor: merge adjecent words into one TextElement #5847

Merged
merged 3 commits into from
Jan 22, 2025

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Jan 22, 2025

tl;dr: this turns [{[foo]}, {[bar]}, {[baz]}] into [{[foo, bar, baz]}].

I don't think I mentioned this here, but I wasn't happy with TextElements being created for every word in a message. Especially because many messages in Twitch chat are mostly text. This wastes about 128B/word, plus an allocation for the QStringList with one element (24B - one string). We can do better! We can append words to existing text elements if they're eligible. A word is eligible if it would've been added with the same flags, color and style.

Because we have the new snapshot tests, you can see the result right here (I hope I didn't miss anything).

@pajlada pajlada merged commit 0a3cc1d into Chatterino:master Jan 22, 2025
18 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants