Abdelmajid BACO

Jan 4, 2019

2 min read

Quick introduction to WebAssembly

WebAssembly or Wasm is a new low-level code that can be executed in modern browsers. It is designed to be fast as native code. Wasm is a compilation target for high-level languages like C, C++ and Rust.

What’s this new low-level code ?

Wasm is a virtual instruction set architecture (V-ISA). It has a binary instructions format like assembly code. The file extension for binary format is «.wasm». Wasm define also a text format which is equivalent to binary format, but readable and editable by humans. This format is also used in browsers when debugging code. The text format extension is «.wat».

Below a simple addition function of integers :

Why Wasm can be Fast as native code ?

Binary instructions are compact and fast to transmit inside the browser. The compilation from wasm instructions into real machine code don’t take a lot of time like classical web language such as javascript.

What does it mean Target compilation ?

Wasm is a compilation target for high-level languages, means that you don’t need to write wasm code by yourself. There are many softwares program that transforms high-level source code written in C/C++, Python, Rust, and C# into wasm. For exemple Emscripten is famous to compile C/C++ into WebAssembly. to have an idea, take a look on this website : https://github.com/appcypher/awesome-wasm-langs

Resources :

Senior Full Stack .Net / Angular Developer, Cloud & Azure DevOps, T-Shirt Designer, Husband, and Father.

Love podcasts or audiobooks? Learn on the go with our new app.