Skip to content

Implementation of various algorithms in WebAssembly and vanilla Javascript

License

Notifications You must be signed in to change notification settings

shubham0204/WASM-JS-Algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Implementation of Algorithms in WebAssembly and Javascript

Problems / Algorithms

Goals

  • Demonstrate the use of WebAssembly modules, compiled from Rust, in a simple HTML + JS webpage
  • Compare the execution time of WASM and plain JS implementations
  • Explore wasm-bindgen and js-sys crates for Rust-WASM compilation

Setup

  1. Install Rust and wasm32-unknown-unknown toolchain with rustup.
$> rustup target add wasm32-unknown-unknown
  1. Clone the repository and compile the target which results in a algo.wasm module in target/wasm32-unknown-unknown/release,
$> git clone https://github.com/shubham0204/WASM-JS-Algorithms
$> cd WASM-JS-Algorithms
$> cargo build --release --target=wasm32-unknown-unknown
  1. Install wasm-bindgen-cli and use it to produce Javascript glue code for algo.wasm in the web directory.
$> cargo install wasm-bindgen-cli
$> wasm-bindgen --out-dir web --target web --no-typescript target/wasm32-unknown-unknown/release/algos.wasm

About

Implementation of various algorithms in WebAssembly and vanilla Javascript

Resources

License

Stars

Watchers

Forks