ig3 / anki-limitnew

Limit the number of new cards in Anki
MIT License
3 stars 0 forks source link

Makes loading some screens slower #2

Closed galantra closed 3 years ago

galantra commented 3 years ago

I noticed that some screens load slowlier with the add-on.

  1. the deck options screen
  2. the browser (major parts of it are white/contentless while loading)
  3. the review screen (the loading times decrease after a handful of consecutive reviews)

I can confirm this only for

Version 2.1.22 (0ecc189a) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1

old scheduler

ig3 commented 3 years ago

If you are using the old scheduler, it would be best to uninstall the add-on. It won't do anything useful.

I should enhance the add-on to check the scheduler and do nothing more if the old scheduler is being used.

If you are using the old scheduler, the add-on should do nothing more than add a couple of parameters to the deck options screen. It doesn't change the old scheduler code at all. I haven't checked, but I don't expect the additional options would cause the old scheduler to run slower.

If you are using the v2 scheduler, there are additional database queries to determine the workload. These will be the major performance impact.

I wasn't aware that the scheduler runs when the card browser loads. It isn't obvious to me why it does, but it certainly does run, so load time will be impacted. I don't see any of the new or modified code running as I browse the cards - only when the browser is loaded. Is this consistent with your experience?

The modified scheduler code runs when the deck summaries are updated (after selecting the Decks display or selecting one of the decks from the Decks display) but not when reviewing cards - at least, not the way I review them, using keyboard shortcuts to navigate. Can you clarify what you are experiencing with the review screen?

I am seeing an additional 0.25 seconds to load the Decks summary. I have four decks and a total of about 30,000 cards, of which I typically review about 500 per day. How much delay are you experiencing? How many decks, cards and daily reviews are you doing? Size of the review log table (revlog) will also impact performance. I have about 150,000 records in the review log, after using Anki for about a year. Do you have significantly more?

There are some inefficiencies in the calculations: some database queries are run more than once as the summaries are updated, but I can't eliminate these without making more substantial changes to the scheduler. If you have many decks with deep nesting, there will be more of these.

ig3 commented 3 years ago

Latest update should be significantly faster. Database queries are slightly modified and results are cached to avoid redundant queries. If you are able to try it, please let me know how it affects performance for you.

galantra commented 3 years ago

Thank you a lot! I don't notice any delays anymore :)

I have 47367 cards, about half of them mature, and review 60-70 per day, currently. The cards are divided into several dozen decks. I don't know how to view the revlog. I've been doing Anki since 2016.

Making an estimation from my memory, it was at least 3 s of delay.