-
Notifications
You must be signed in to change notification settings - Fork 887
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
Improve performance of the watch history handling #4017
Improve performance of the watch history handling #4017
Conversation
I can confirm this version gets switching between profiles on the subscriptions page back to being instant, from the ~2s it is currently. |
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.
LGTM
All seems great, except I see a new error when importing history that was exported from this PR (Picture 1) compared to history that was exported from the |
@jasonhenriquez |
I think the issue is probably unrelated as this doesn't touch any of the import code. |
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.
Readability
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.
Tested others except
Watch history and watch progress get saved and restored on the next playback (well the watch progress might not get restored, as it is now fast enough that it might try to do it before the video is loaded, yes it's a race condition that I am fully aware of, using a link with a timestamp doesn't work either if you have no history)
Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
* development: Improve performance of the watch history handling (FreeTubeApp#4017) # Conflicts: # src/renderer/components/ft-list-video/ft-list-video.js # src/renderer/store/modules/history.js
Improve performance of the watch history handling
Pull Request Type
Related issue
closes #3796
Description
Currently all watch history interactions go through a chronologically sorted list, which is great for the history page, so that it displays items in the right order, but less than ideal if you need to check if a video is watched. For most users this will likely never be a problem, but for users like the ones in the issue, that have gigantic watch histories (32k+), this means that video lists and especially the subscriptions page, slow down.
This pull request introduces an additional history object, this time it is an object (vuex doesn't support
Map
s) with the video ids as the keys. This should allow for almost instant lookups, which should speed up video lists and any other place that accesses the watch history to check that an entry exists and read properties from them.Testing
Check that history handling still works as expected:
@Nemo157 @apatheticslacker @StrangestNoob
As none of the devs have a large enough history to encounter any performance problems, it would be really helpful if you could test this pull request and check if it solves the problem for you. (Ideally all 3 of you, but mainly @Nemo157 as you opened the bug report).
Here is a test build you 3 can download, so that you don't have to set up a development environment to test it: https://github.com/absidue/FreeTube/actions/runs/6136849377
Desktop