Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up optimal_retention() #168

Merged
merged 6 commits into from
Mar 12, 2024
Merged

Conversation

L-M-Sherlock
Copy link
Member

@L-M-Sherlock L-M-Sherlock commented Mar 11, 2024

It's ~25% faster than before, especially when the learn_span is long.

The time complexity of simulate() is O(kn^2), where k is learn_limit and n is learn_span. It costs ~30s to find the optimal retention with learn_span=3650 and learn_limit=10. In previous implementation, it costs ~40s.

cargo test --release -- optimal_retention::tests::optimal_retention

It's not recommended to set a learn_span greater than 3650.

It costs ~250s to find the optimal retention with learn_span=10000.

I hope it is the last improvement on FSRS-rs before the release of Anki 24.04. @dae

@L-M-Sherlock L-M-Sherlock added the enhancement New feature or request label Mar 11, 2024
@L-M-Sherlock L-M-Sherlock merged commit 0634cb0 into main Mar 12, 2024
3 checks passed
@L-M-Sherlock L-M-Sherlock deleted the speed-up-optimal_retention() branch March 12, 2024 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants