Skip to content

increase efficiency #375

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

Merged
merged 1 commit into from
Jul 23, 2025
Merged

increase efficiency #375

merged 1 commit into from
Jul 23, 2025

Conversation

Uniquely6958
Copy link
Contributor

This aims to increase the efficiency of the code by changing several things. I personally use a provider with a lot of channels, and the application was unusable for me. I decided to dip into the code and see if anything could be changed.

First, I noticed that when categories were being displayed, the flowbox was being rendered for each individual category - there shouldn't be any reason this is required. Rendering everything once at the end is fine. Additionally, a good idea to add onto here would be to freeze the flowbox when adding the groups, and thaw after. That way all rendering is paused until all groups have been compiled. In the worst case, time required to display all groups was 15 seconds. This dropped down to 3 seconds on my computer.

The biggest change was how the search works. Currently, the channel listbox would show all the possible channels, then apply a filter to remove any we don't want. This was wasteful and largely unnecessary, since the required channels would be re-added back to the list if the user filtered by category. Usually when I used to search, I used to search for one specific channel I knew, and it would still try to show all channels, and then filter through them. To remedy this, only the channels that should appear to the user will now be passed to show_channels. Filtering this way is greatly better as it avoids looping through all possible channels in the provider. It avoids the need for images for channels that won't even be shows, and it avoids creating a new object while adding it to the listbox. If the user performed another search, we would only have the previous channels shown, so instead now we just redraw the channels that are required.
This has hugely improved the speed and performance for me. As I mentioned, I have a provider with a very large number of channels, so searching was the only reasonable way for me to get to where I want. And for each search, looping through all channels was just not feasible. It used to routinely take upwards of 3 to 4 minutes, after which I'd give up. This is now basically instantaneous.

However, I feel the best way forward would be to add a scroll listener and dynamically load channels when they are required.

devlich added a commit to devlich/htv that referenced this pull request Jul 5, 2025
@clefebvre clefebvre merged commit ffbfd75 into linuxmint:master Jul 23, 2025
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