Speed up React with WebAssembly
What you end up with: a React app where the slowest function runs in Rust, compiled to WebAssembly, with benchmarks that show what actually got faster — and, more usefully, what did not.

The web is where most developers are, and WebAssembly is the shortest path from that world into Rust. It is also the track where people most often fool themselves: “10x faster in the benchmark” usually means “we measured the wrong thing”. Here you measure the browser, not the microbenchmark.
What you’ll build
Section titled “What you’ll build”- A React app that renders and searches a large dataset in the browser
- The same logic in JavaScript and in Rust/WASM, with a switch between them
wasm-bindgenglue for strings, arrays and structs- A Web Worker so the UI never blocks
- A benchmark page using
performance.now(), plus the size cost of the.wasmbundle - A production build with preloading and a real size budget
Before you start
Section titled “Before you start”- Variables, types, and functions — enough Rust syntax to write real code
- Collections and strings — you will pass
VecandStringacross the boundary - Working knowledge of React, npm, and the browser dev tools
If you have never written Rust before, do not start here — the basics and ownership first, then come back; the whole point of this track is that you can tell which side of the boundary the work belongs on.
Articles
Section titled “Articles”- What we’re building: Rust in the browserthe slow function, and the benchmark we will beat
- Setting up wasm-bindgen and wasm-packthe toolchain, and the pkg directory it emits
- Calling Rust from JavaScriptstrings, numbers, and what crosses the boundary
- Choosing a real function to optimiseprofile first, or you will optimise nothing
- Passing large data without copyingviews over wasm memory
- Benchmarking WebAssembly honestlyJIT warm-up, and why most published numbers are wrong
- Wiring WebAssembly into a React appVite, workers, and keeping the UI responsive
- When WebAssembly is the wrong answersize, boundary crossings, and small inputs
Where the code lives
Section titled “Where the code lives”react-wasm/ in the examples repository — the
JS version, the Rust version, and the benchmark harness.