Anki Forums

Long processing time for note types with many card types

I have noticed an irregularity when using AnkiMobile as compared to using AnkiDesktop.

AnkiMobile takes proportionally longer to render cards in the reviewer, if their note type has a lot of card types.

I have uploaded an example deck here.
It contains two notes with three cards per note. One note has a note type with a lot of card types (100). The other note has a note type with very few card types (3). All card types are (basically) the same.

When I review the deck on AnkiDesktop, all cards take about the same time to process. However when I try to review the deck on AnkiMobile, the cards which belong to the note type with 100 card types take a very long time to render in the reviewer, compared to the cards with belong to the note type with only 3 card types.

It seems like the existence of other card types impacts the rendering of the card. How come so?

Closet appears to be stuffing all of the Javascript into each card template. At 140k per template, 100 cards means the note type is storing at least 14MB of data which needs to be read and parsed. I imagine you can make things a lot faster if you move the JS to an external file.

As for why AnkiMobile is slower here, it’s because the note type fetching doesn’t currently employ a cache. This will likely change in the future as more of the legacy code is migrated away from.