Skip to content
Web Design & Development

A Practical Guide to WebAssembly Basics

A binary format that lets code written in languages such as C++ or Rust run in the browser at near-native speed.

Marcus Adeyemi Technical Director 2 min read 27 views
A Practical Guide to WebAssembly Basics

What is at stake

WebAssembly suits heavy computation such as image processing and simulations, but it is not a replacement for JavaScript.

The playbook

  1. Use WebAssembly for compute-heavy work
  2. Keep modules small and lazy loaded
  3. Measure against a JavaScript implementation
  4. Handle load failures gracefully
  5. Watch memory use on mobile

Where it goes wrong

Avoid:

  • Rewriting interfaces in WebAssembly
  • Large modules on first load
  • Assuming automatic speed gains
  • Ignoring fallbacks
What to do and what to avoid with WebAssembly basics, side by side
Good practice against the usual mistakes, from the sources listed below.

The numbers behind it

Published figures for WebAssembly Basics
MeasureFigure
Formata portable binary instruction format
InteropWebAssembly modules are called from JavaScript
DOM accessmodules access the page through JavaScript
Sizemodules add to download weight

Getting outside help

When to hand it over: Bring in help when browser-side computation is a bottleneck.

Where this comes from

The figures and practices above come from the sources listed.

Working on something like this?

We take on Web Design & Development work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.

Where to go next

Spotted something wrong? Report an error on this page. We correct on the page and say what changed.

All services

The work behind this article, and what it costs.

Marcus Adeyemi

Builds and maintains the web work. Writes about front-end architecture, performance, accessibility and the unglamorous parts of keeping a site alive.

Keep reading

More in Web Design & Development