A (very) brief Introduction to WebAssembly

Rifo Ahmad Genadi
HMIF ITB Tech
Published in
2 min readMay 25, 2019

Well, I just finished the first week of my internship as a software development engineer at a certain company in Indonesia. The first thing I asked to do was to learn what on earth is this WebAssembly thing.

So… here it is…

WebAssembly (Wasm) is a binary instruction format designed by W3C for a stack-based VM. It is a compilation target for programming languages like C, C++, Rust, etc., enabling them to be executed on a web application — client- and/or server-side. It is a way to run your non-JavaScript program on a browser.

The main advantage is, since Wasm is in a binary form, which is closer to machine language than a high-level programming language, Wasm runs fast— at least faster compared to a JavaScript program.

Well, other than that, some other reasons why Wasm is way faster are:

  • WebAssembly is more compact than JavaScript
  • Decoding WebAssembly takes less time than parsing JavaScript
  • There is no garbage collector

So, will Wasm replace the whole ‘JavaScript based’ web applications?

No. You can see at Wasm logo itself.

Image from https://www.i-programmer.info/images/stories/News/2017/mar/A/jswasm.jpg

WebAssembly designed to work alongside JavaScript. The common workflow is:

  1. Write a code in a programming language other than JavaScript
  2. Compile it to Wasm
  3. Load the Wasm from JavaScript

And… voila, you can use your program on your JavaScript web apps, then run them on the browser.

Further Learning

This post lacks many details, so I curated some links that may help you get a better understanding about WebAssembly. I really encourage you to check them out:

--

--