-
Notifications
You must be signed in to change notification settings - Fork 854
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
Playlist performance improvements #4597
Playlist performance improvements #4597
Conversation
Since we probably only merge this PR instead of that I think it's better to also include that fix as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like too many nesting levels :)
Yes, I'm sorry that I didn't explain that well enough in the pull request description. That is out of scope of this pull request though, as it will require a complete rethink of how we do lazy loading (see section about virtual scrolling). Our current lazy loading implementation throughout the app, requires you to have one div per item (video, channel, playlist) to exist at all times, so that you can detect when it becomes visible (gets scrolled into view) and trigger the loading of it's children. A better but more complicated to implement approach would have a parent element be in charge of the entire list, making sure that there are only ever enough items in the DOM, as are actually visible items. That probably involves listening to scroll events and reacting based on that or something. I haven't looked into how other virtual scrolling implementations work, so I not quite sure how we would do it. |
I am not talking about the no. of divs |
Co-authored-by: PikachuEXE <git@pikachuexe.net>
I can't seem to be able to reproduce that problem on this pull request, happy to try fixing it if you can provide steps to reproduce it. |
As far as I can tell this is working as expected, all divs with the |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No conflict good enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very unrelated to this PR but, big number likes to hide behind thumbnail
VirtualBoxVM_APnwNpnU8V.mp4
…into custom-builds/current * feature/playlist-search-videos-in-one-user-playlist-2: ! Fix load more button appears when searching & visible items under pagination limit * Update single playlist view for user playlists to add search video function Playlist performance improvements (FreeTubeApp#4597) ! Fix playlist type not passed when playing next/prev item in a user playlist (FreeTubeApp#4623) Properly localize playlist view and video counts (FreeTubeApp#4620) Translated using Weblate (Croatian)
* development: (92 commits) Make video info section more concise (FreeTubeApp#4338) Playlist performance improvements (FreeTubeApp#4597) ! Fix playlist type not passed when playing next/prev item in a user playlist (FreeTubeApp#4623) Properly localize playlist view and video counts (FreeTubeApp#4620) Translated using Weblate (Croatian) Translated using Weblate (German) Translated using Weblate (Croatian) Fix search bar handling of Invidious channel URLs (FreeTubeApp#4568) Local API: List related games in featured channels section (FreeTubeApp#4562) Workaround community post slider dependency incorrectly calculating its size (FreeTubeApp#4598) Add support for viewing movie trailers with local api (FreeTubeApp#4391) Bump the eslint group with 2 updates (FreeTubeApp#4616) Translated using Weblate (French) Translated using Weblate (Finnish) Bump electron from 28.1.4 to 28.2.0 (FreeTubeApp#4611) Translated using Weblate (French) Bump the eslint group with 4 updates (FreeTubeApp#4581) Bump lefthook from 1.6.0 to 1.6.1 (FreeTubeApp#4608) Bump marked from 11.1.1 to 11.2.0 (FreeTubeApp#4612) Bump webpack from 5.89.0 to 5.90.0 (FreeTubeApp#4610) ...
Playlist performance improvements
Pull Request Type
Related issue
#4578
Mostly solves the issue, however we will need to do some more involved refactoring to fix the watch page entirely.
Description
This pull request addresses some of the performance problems concerning gigantic user playlists (over 17k items) that were brought up in the linked issue. It doesn't completely solve the issue, especially on the watch page, as we are still rendering at least one
<div>
per playlist item, so that we can figure out when to load the items (there is a reason YouTube only displays a maximum of 200 videos on their watch page), we also don't unload items when they disappear from view again. Fixing the watch page properly will require switching to a virtual scrolling approach, so that we really only have as many HTML elements in the DOM as we really need, which is out of scope of this pull request.Here is the list of changes that this pull request makes:
ft-list-video
element slightly cheaper to render:watched
property with thehistoryEntryExists
computed property, as they served the same purpose.The final result is that the playlist page loads quickly, as it only has to render 100 items initially, however if you press load more enough times, things do slow down, because we don't unload items once they are loaded. The watch page is still slow to load, it did go from 16.24 to 14.88 seconds with the test playlist on my computer, but that is still slow. Doing a performance benchmark shows that the majority of time is spent in Vue's internals, as it struggles with the sheer number of component instances and DOM elements (16200+ of each).
Testing
FreeTube
) withElectron
https://docs.freetubeapp.io/usage/data-location/)playlists.db
The playlist was created by copying https://www.youtube.com/playlist?list=PLxYGDfxfyiF85ZwSBchVX7datipeOJhtH multiple times inside itself.
Desktop