In this article we will have a quick look at one of newest technologies in browser based application programming, the new “WebAssembly” technology, and explain its potential impact for the future.
In 2015, Mozilla MDN decided to start WebAssembly project to create a common, low level bytecode format for browser execution, which will allow pre-compiled assemblies to be executed inside browsers on (near) native speeds. Initial version of WebAssembly is build on Mozilla’s “asm.js” technology, which is used today for mostly browser based gaming. The initiative gained support by all major browser developers (Google, Microsoft and Apple) and as of late 2017, they all support execution of WebAssembly binaries in their browsers.
Here is a quick overview of WASM compilation steps into byte code (taken from Wikipedia https://en.wikipedia.org/wiki/WebAssembly)
|C expression||Textual (WAT) expression for debugging||Linear assembly bytecode||WASM binary encoding|
Some of the advantages WebAssembly brings are :
- You will be able to use your favorite programming language, like Java, C# or C++ to write browser apps, then compile and embed it into the browser to run it.
- It has a human readable, understandable, intermediate textual script language for debugging purposes called WAT (Web assembly text format), you do not have to debug assembly code or asm.js directly.
How can we use WebAssembly?
More info on compiling C/C++ into WebAssembly can be found in following MDN webpage :
There are also several different future projects planning to use WebAssembly as their base technology. To mention some of those :
- Unity game engine : From of version 5.6, Unity has an experimental compile target for WebAssembly platform. A demo game can be seen in the WebAssembly portal :
- Mono project : Mono is the open source implementation of “.NET Framework” which allows .NET code to be executed on different platforms like Linux. Mono team is working on an implementation on WebAssembly platform to allow .NET code and .NET WinForms projects to be compiled into and run directly in a web browser using WASM. For more info :
- Rust : Rust is a C++ based modern programming language which has many practical features. Since it is also sponsored by Mozilla, today it is possible to compile Rust directly into WebAssembly using it’s compiler tools. For more information :
- Kotlin : Kotlin is a new programming language which is mainly developed for programming in Android platform, as a more modern and functional alternative to Java language. Kotlin’s native compiler can compile Kotlin code directly into WebAssembly.
For more information on web assembly, visit :