Skip to content
BENIBIX Learn

WebAssembly (Wasm)

Development⚙️ Compilers & RuntimesCompilation

Also known as Wasm, .wasm

Fast code that browsers run. Code in other languages is turned into it.

Think of it like

Think of it like a plug that fits all the sockets. Code in lots of languages can plug in.

Example

Emma's photo editor has a blur tool written in Rust. Built as Wasm, it runs in the browser about as fast as the desktop app.

Why it matters

It brings heavy apps to the web without a download. It also lets code in many languages run in a browser.

Definition

WebAssembly is a small code format that browsers run almost as fast as a normal app. You do not write it by hand. You write C, C++, Rust or Go, and a compiler turns it into a .wasm file. The browser loads that file and runs it beside JavaScript, in the same safe sandbox. It is used for games, photo editors and other heavy work in the browser.

Common mistake

Expecting it to replace JavaScript. It is a partner for heavy work, and it still needs JavaScript to touch the page.

Key takeaways

  1. 1
    Compile to it. From C, C++, Rust or Go.
  2. 2
    Close to native speed. Good for heavy work.
  3. 3
    Runs beside JavaScript. In the same safe sandbox.