Introduction
This is a step-by-step tutorial to demonstrate how to run computations expressed with orx-parallel’s parallel iterators in a threaded WebAssembly browser app.
The project has three parts:
computation/contains ordinary Rust code and tests.wasm_bindings/exposes the Rust functions to JavaScript.app/contains the HTML, CSS, TypeScript, and Vite configuration. TypeScript client calls parallel computations through a worker.
The app starts one shared thread pool. threads: 0 lets the runtime choose the available capacity. Each computation also receives a thread count: 0 uses all initialized threads, while a positive value limits that computation.
Prerequisites
Install Rust and Cargo, Node.js and npm, and the wasm32-unknown-unknown Rust target:
rustup target add wasm32-unknown-unknown
Get started
Create your example application’s directory
mkdir par_wasm
cd par_wasm