What is WebAssembly?
According to the official documentation from webassembly.org:
So its purpose is to give developers the possibility to create a web app using languages like C, C++ or Rust. Why would anyone want to do that? Here are a couple of reasons:
- Some experiments show that parsing WebAssembly code can be more than 20 times faster. This is a big deal especially for mobile devices.
- Because WebAssembly is a low-level language with a very compact binary format, is much faster to load than .js files which are textual and can get large very fast.
- It will be significantly easier to build cross-platform apps that support web and native environments.
When to use WebAssembly?
There are many use cases where you could use it such as AI, VR and augmented reality apps or apps with heavy graphics like games where there are many function calls made in the browser which slows it down. You can find a big list of use cases here.
What I don’t like about WebAssembly
- Multithreading is currently not supported in WebAssembly.
- Not enough resources. I wish there was more documentation or places to learn how to use WebAssembly. I guess if everything goes well there will be more and more resources available over the next couple of years.
Ok, enough talking…Lets see some examples: