Avoiding allocations in Rust to shrink Wasm modules

from blog nickb.dev, | ↗ original
Rust lacks a runtime, enabling small .wasm sizes because there is no extra bloat included like a garbage collector. You only pay (in code size) for the functions you actually use. The Rust Wasm Book, “Why Rust and WebAssembly?” We can see small Wasm sizes in action with a contrived example: use wasm_bindgen::prelude::wasm_bindgen; #[wasm_bindgen]...