This folder contains the inference logic, written in Rust and compiled to WebAssembly (WASM).
If you're looking for an explanation about how the logic works, go here.
Two reasons:
-
It is much, much faster. The speed difference is negligible under normal use, but the "Calculate Odds" feature requires a huge amount of iterations, which is incredibly slow with JavaScript. I've noticed it being upwards of 4× faster than the original implementation.
-
It's a neat experiment! I haven't used WASM before, and this felt like a good excuse. I also found that the change in bundle size is relatively negligible (~124 KB), espcially when compressed (~44 KB with Brotli).
This project requires Rust and wasm-pack.
Once installed, run the following in the inference/
directory to build with optimizations:
wasm-pack build --release --target bundler
This project is licensed under the GNU Affero General Public License, Version 3.0 (LICENSE or https://www.gnu.org/licenses/agpl-3.0.en.html).