Skip to content

Latest commit

 

History

History
32 lines (20 loc) · 1.34 KB

README.md

File metadata and controls

32 lines (20 loc) · 1.34 KB

Inference Logic

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.

Why Rust/WASM?

Two reasons:

  1. 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.

  2. 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).

Building

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

License

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).