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 ?
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