Skip to content

Conversation

@absidue
Copy link
Member

@absidue absidue commented May 24, 2024

Cache quick bookmark playlist to reduce the amount of lookups

Pull Request Type

  • Performance improvement

Description

The quick bookmark playlist is accessed in many places in the app, most notably inside every ft-list-video instance to check if said video is in the quick bookmark playlist. Every place that needs the quick bookmark playlist currently searches for the playlist by itself, not just when it's created but any time that any playlist is updated or the quick bookmark target is updated. This pull request moves that search into a getter inside the playlist store. Getters inside the vuex store cache their result (not if you return a function though) and are lazily evaluated, just like computed properties inside a component. That means that the search only needs to be done once, per triggering change, instead of many times.

I'm not expecting this improvement to be drastic enough to be noticeable without measuring tools, but it's still worth it as we are doing less work.

Testing

Add videos to and remove videos from the quick bookmark playlist, while checking that the icon still updates accordingly.

Desktop

  • OS: Windows
  • OS Version: 10
  • FreeTube version: 6481123

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) May 24, 2024 20:35
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label May 24, 2024
@FreeTubeBot FreeTubeBot merged commit 6034316 into FreeTubeApp:development May 25, 2024
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label May 25, 2024
@absidue absidue deleted the cache-quick-bookmark-playlist branch May 25, 2024 10:28
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request May 26, 2024
* development:
  Fix channel sort values to show the values they are (FreeTubeApp#5162)
  Translated using Weblate (Russian)
  Translated using Weblate (French)
  Quick bookmark button RTL & hover fixes (FreeTubeApp#5157)
  Use addVideo instead of addVideos for quick bookmark button (FreeTubeApp#5168)
  Cache quick bookmark playlist to reduce the amount of lookups (FreeTubeApp#5169)
  Translated using Weblate (Arabic)
  Translated using Weblate (Indonesian)
  Fix hide/show channel in ft-list-video (FreeTubeApp#5149)

# Conflicts:
#	src/renderer/components/ft-list-video/ft-list-video.js
#	src/renderer/components/watch-video-info/watch-video-info.js
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.

5 participants