card.card_stats_data()
became slow after Feat/forgetting curve in card info by L-M-Sherlock · Pull Request #3437 · ankitects/anki · GitHub because it computes the memory state for each revlog. For card with 40+ revlogs, it costs ~400ms to return the result. It’s not perceivable when opening the card info page. But it slows down add-ons which use card_stats_data()
to get the revlogs of thoustands of cards significantly.
I have some solutions:
- add an option to
card_stats()
to control whether to compute the memory state for each revlog. - add a new api to fetch the revlogs of given card.
- refactor the calculation method of historical memory states to reduce the computation complexity from O(n^2) to O(n). It requires a refactor on FSRS-rs part.
@dae, sorry for bothering you. I want your advice before I work on the new PR.