Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

refactor: load images in workers and push immediately #5431

Merged
merged 7 commits into from
Jun 2, 2024

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Jun 1, 2024

This PR refactors the image loading (and cleans up some of the code there, so make sure you disable whitespace when viewing the diff). It moves the loading of frames to a worker thread (the one we get from the network request).

Since the only work left is to assign the parsed frames to the image, this can be done in one go (no more queue). Once the frames are loaded, they are immediately pushed.

Technically, if many images load between two gui-thread-event-loop iterations, this could bloat the event-queue. Although I haven't measured, I don't think this is a bottleneck. When notifying channels, however, updates are batched to at most one per iteration.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@pajlada pajlada merged commit d00cadf into Chatterino:master Jun 2, 2024
17 checks passed
@Nerixyz Nerixyz deleted the refactor/image-stuff branch June 2, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants