open-spaced-repetition / fsrs-rs

FSRS for Rust, including Optimizer and Scheduler
https://crates.io/crates/fsrs
BSD 3-Clause "New" or "Revised" License
185 stars 19 forks source link

support WASM #99

Closed hxse closed 1 year ago

hxse commented 1 year ago

Running locally in the browser and no longer depend large company server. Support WASM will be nice, is it possible?

L-M-Sherlock commented 1 year ago

It's feasible, but the framework doesn't provides a document for that: https://burn-rs.github.io/book/advanced/index.html

cjdduarte commented 1 year ago

I would support a migration of Anki Web (frontend) to WASM. However, I understand that it should be entirely rewritten in RUST (another framework).

But I think if it were to move forward, it would be a project for the end of 2024/ beginning of 2025.

AlexErrant commented 1 year ago

Technically speaking, as of this PR, fsrs-rs compiles to WASM, satisfying this issue. However, more work needs to be done to make it usable from Javascript, which is probably what you want. I started work on a wrapper for fsrs-rs here https://github.com/AlexErrant/fsrs-wasm but it's very much a WIP. I got next_interval exposed to JS, but I'm missing the ability to create an "FSRS" object with weights, so you can't even call it (next_interval). I stopped working on it to chase other shiny objects, but I'll return to it eventually. (Currently trying - and failing - to learn Rust 😬.)

If you're just looking to run the scheduling algorithm, a pure JS solution exists https://github.com/open-spaced-repetition/fsrs.js You only need this repo if you want to run training of the ML model. There's also https://github.com/open-spaced-repetition/rs-fsrs if you're just looking for a scheduler.

AlexErrant commented 9 months ago

As an FYI, I renamed fsrs-wasm to https://github.com/AlexErrant/fsrs-browser because it very much only runs in the browser. Also, I got that project demoing compute_weights, which is nice. I think all the hard work/proof of concept is done, will iterate as needed.