WebAssembly Fundamentals
WebAssembly (Wasm) is a compact binary instruction format that runs inside web browsers and other host environments at near-native speed. Developers write code in languages such as C, C++, Rust, or Go, compile it to a WebAssembly module, and load that module alongside ordinary JavaScript. It exists to run computation-heavy tasks, such as image processing, physics simulation, or a ported native application, in places JavaScript alone runs too slowly.
itWeb development | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic - WebAssembly Fundamentals
WebAssembly, usually shortened to Wasm, is a compact binary format that runs compiled code inside a browser at close to native speed. It did not turn up to replace JavaScript. It sits next to it, as a sandboxed guest that JavaScript loads, sets up, and calls into whenever the job is too heavy for JavaScript to do comfortably alone.
Before Wasm, that job belonged to asm.js: a strict, typeable subset of JavaScript that browsers could optimize aggressively, invented specifically to prove a browser could run cross-compiled C code fast. It worked. It was also still JavaScript text, which a browser had to parse before running, which is the slow part this format exists to skip.
Here is the shape everything else hangs off. A compiler turns C, C++, Rust, or Go into a module, which is compiled bytecode and nothing more. Instantiating that module pairs it with its own memory and its own table of function references, producing an instance that can actually run. One module, instantiated twice, gives you two instances that share nothing. And almost everything expensive or unsafe in this course traces back to one fact: a module only exchanges plain numbers with its host for free. A string has to be copied into its memory by hand. An object generally can't cross at all without help.
The surprise, if you have heard of WebAssembly secondhand, is where the speed actually comes from. Figma's engineers reported a 3x load-time win moving from asm.js to Wasm, and the honest reason was parsing roughly 20x faster and the browser caching the translated native code, not faster arithmetic. If your mental model is "Wasm makes my loops run faster," that's the wrong lever half the time; the real one is how fast the thing loads and starts.
The other outdated bit, if what you know is a few years stale: "Wasm is for C, C++, and Rust" stopped being the whole truth in 2023, when Chrome shipped WasmGC, letting the host's own garbage collector manage memory for languages like Java and Kotlin. Before that, those compilers had to bring their own collector, badly.
For the honest mechanics of module, instance, memory, and the boundary, read the intro. For a fast conceptual map with the compile-versus-instantiate distinction laid out side by side, the slides. For the actual commands, wasmtime, wat2wasm, emcc, and what each does, the cheatsheet and the practice reference. None of it requires a pager. Most of it does require remembering that the boundary is where the bodies are buried.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://webassembly.org/
Supports
- WebAssembly's identity as a binary instruction format for a stack-based virtual machine
- The four design goals: fast, safe, open, debuggable
- Reference-path rationale for the project homepage
- https://webassembly.org/roadmap/
Supports
- November 2017 browser-implementer consensus that the MVP design and binary format was complete
- The Phase 1-5 WebAssembly Community Group proposal process
- https://webassembly.org/specs/
Supports
- Wasm 1.0 reaching W3C Recommendation status on December 5, 2019
- Wasm 2.0 reaching Candidate Recommendation Draft status in 2025
- Wasm 3.0 as the current Core specification version
- The JS API, Web API, and WASI API as separate embedding interfaces
- https://webassembly.github.io/spec/core/
Supports
- Normative reference for module sections, value types, and instruction semantics used in the cheatsheet
- Reference-path rationale as the authoritative spec document
- https://github.com/WebAssembly/proposals
Supports
- The Phase 1 through 5 proposal-maturity process and its meaning for production readiness
- Threads and Component Model proposal status examples
- https://developer.mozilla.org/en-US/docs/WebAssembly/Guides/Concepts
Supports
- Module as stateless compiled bytecode vs. instance as a module paired with live runtime state (memory, table, imports)
- Linear memory as a resizable ArrayBuffer-backed byte array
- Table as a resizable array of typed references, used for indirect function calls
- The 1:1 correspondence between WAT text format and binary format
- JS/Wasm bidirectional function calling through the JavaScript API
- Value types (i32/i64/f32/f64/v128/funcref/externref) and module sections
- https://developer.mozilla.org/en-US/docs/WebAssembly/Guides/Loading_and_running
Supports
- WebAssembly.instantiateStreaming() compiling while bytes are still downloading, vs. WebAssembly.instantiate() requiring a buffered ArrayBuffer first
- The { module, instance } return shape of instantiate calls
- Calling exported functions and reading exported memory via instance.exports
- https://developer.mozilla.org/en-US/docs/WebAssembly/Guides/Text_format_to_Wasm
Supports
- Writing a small module in WAT and converting it with wat2wasm
- Reference-path rationale for the text-format walkthrough
- https://wasi.dev/
Supports
- WASI as a capability-based standard for non-browser Wasm execution
- No ambient authority; a module receives only explicitly granted capabilities
- Use cases: plugin models, serverless functions, edge computing, database UDFs
- https://docs.wasmtime.dev/
Supports
- Wasmtime as the Bytecode Alliance's standalone WebAssembly runtime
- Reference-path rationale for running modules outside a browser
- https://docs.wasmtime.dev/cli-options.html
Supports
- `wasmtime foo.wasm` running a module directly from the command line
- `--dir` granting WASI filesystem access rooted at a specific directory, with no access outside it when omitted
- `-W`/`--wasm` enabling specific proposals not on by default
- https://emscripten.org/docs/getting_started/Tutorial.html
Supports
- `emcc` basic compilation producing a .js loader and .wasm binary
- `-O1`/`-O2` optimization flags and their debugging trade-off
- `--preload-file` bundling data into the module's virtual filesystem
- https://emscripten.org/
Supports
- Emscripten as the LLVM-based C/C++-to-WebAssembly compiler toolchain
- Landscape placement and role description
- https://rustwasm.github.io/wasm-pack/
Supports
- `wasm-pack build --target web` producing a pkg/ directory with .wasm, JS loader, and TypeScript types
- `wasm-pack test --headless --firefox` running tests inside a real browser engine
- Landscape placement and role description
- https://rustwasm.github.io/docs/book/
Supports
- Reference-path rationale for Rust/Wasm interop depth (wasm-bindgen, JS boundary marshaling)
- https://rustwasm.github.io/wasm-bindgen/
Supports
- wasm-bindgen generating JS/Rust glue code that automates linear-memory marshaling for strings and structured data
- https://github.com/WebAssembly/wabt
Supports
- wat2wasm, wasm2wat, wasm-validate, and wasm-objdump as WABT's core tools and what each does
- https://github.com/WebAssembly/binaryen
Supports
- Binaryen as compiler infrastructure Emscripten uses internally to optimize/transform Wasm binaries
- https://github.com/mbasso/awesome-wasm
Supports
- Curated discovery source for Awesome Links entries (AssemblyScript, TinyGo, Wasmer, WAMR, wasm3, WABT, Binaryen)
- https://www.assemblyscript.org/
Supports
- AssemblyScript as a TypeScript-like language compiling directly to WebAssembly
- https://tinygo.org/
Supports
- TinyGo as a Go compiler producing smaller Wasm output than the standard Go toolchain
- https://wasmer.io/
Supports
- Wasmer as a standalone runtime with bindings for Python, Go, PHP, and Ruby, plus a paid hosted deployment layer
- https://github.com/bytecodealliance/wasm-micro-runtime
Supports
- WAMR as a Bytecode Alliance runtime built for embedded, resource-constrained targets
- https://github.com/wasm3/wasm3
Supports
- wasm3 as a compact interpreter running on small architectures including microcontrollers
- https://pyodide.org/
Supports
- Pyodide compiling CPython and the scientific Python stack to WebAssembly for client-side execution
- https://spinframework.dev/
Supports
- Spin as a CNCF framework for building serverless WebAssembly component applications with fast cold starts
- https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor
Supports
- Blazor running the .NET runtime as a Wasm module client-side
- https://workers.cloudflare.com/
Supports
- Cloudflare Workers running request handlers as Wasm instances at the edge instead of full containers
- https://www.fastly.com/products/edge-compute
Supports
- Fastly Compute built on Wasmtime, instantiating a fresh Wasm instance per request
- https://bytecodealliance.org/articles/ten-years-of-webassembly-a-retrospective
Supports
- Timeline dates: asm.js (March 2013), formal WebAssembly announcement (June 17, 2015), Firefox first browser support (March 2017), all four major browsers supporting Wasm by end of 2017, Mozilla announcing WASI (March 2019), WASI 0.2/Component Model launch (January 2024)
- https://www.theregister.com/2015/06/18/brendan_eich_announces_webassembly/
Supports
- Corroborating account of the June 17, 2015 coordinated four-browser WebAssembly announcement
- https://blog.scottlogic.com/2019/07/15/multithreaded-webassembly.html
Supports
- July 2019 state of WebAssembly threads: Chrome-only support, gated behind SharedArrayBuffer, which every vendor had disabled after Spectre/Meltdown and only Chrome had re-enabled via site isolation
- https://web.dev/articles/coop-coep
Supports
- Cross-origin isolation (COOP same-origin + COEP require-corp) as the prerequisite for SharedArrayBuffer/WebAssembly threads after Spectre
- Cross-origin resources and popups breaking without cooperating headers
- https://developer.chrome.com/blog/wasmgc
Supports
- WasmGC (WebAssembly Garbage Collection) enabled by default in Chrome 119, adding struct/array heap types managed by the host engine's own garbage collector
- https://madebyevan.com/figma/webassembly-cut-figmas-load-time-by-3x/
Supports
- Figma's reported 3x load-time improvement moving from asm.js to WebAssembly, attributed to ~20x faster parsing and native-code caching rather than faster arithmetic execution
- Compressed download size barely changing between asm.js and Wasm
- Chrome-specific bugs (caching, crashes) limiting the initial rollout to Firefox
- https://component-model.bytecodealliance.org/
Supports
- The WebAssembly Component Model letting independently compiled components share high-level types across a defined interface
