Skip to content

Conversation

@BrayanDSO
Copy link
Owner

Purpose / Description

This PR improves the initialization time of the Tags Dialog. In small and medium sized collections, there won't be a significant difference because they load fast anyway. But in large ones, with many tags and notes as Anking, there is a big difference when editting the notes of a lot of cards.

This only fixes most of the initialization slowdown caused by ankidroid#16356. While investigating the tags loading process, I found that several improvements could be done in TagsList and TagsArrayAdapter. There's also the new backend tags.tree() method that may be useful. But, those are fairly complex classes (which solve the fairly complex issue of building a tags tree) and dealing with them would take a lot of time.

Fixes

Approach

  1. Fetch the note tags only once
  2. Write only the note IDs into a file, instead of all the tags
  3. Use a ViewModel to load the tags

How Has This Been Tested?

Tested in two scenarios in an API 35 emulator. Both used the Anking V11 deck.

The "default" scenario is using "filter by tag", without fetching any note tags

The "worst" scenario is fetching all the 43.000+ notes in Anking

Default scenario

default_before.mp4
default_after.mp4

Worst scenario

worst_before.mp4
worst_after.mp4

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@BrayanDSO BrayanDSO closed this May 10, 2025
@BrayanDSO BrayanDSO deleted the improve-tags branch June 3, 2025 23:38
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.

[BUG]: Tags dialog is unacceptably slow to load

2 participants