What is WebAssembly?

What is WebAssembly?

WebAssembly, which is often shorted to Wasm or WA, is a small, fast binary format which promises near-native performance for web applications. It is a new type of code that can be run in modern web-browsers and provides new features and gains in the performance. It is designed to be a compilation target for other languages to get first-class binary support across the entire web platform stack.

Why did it emerge?

For a while now, JavaScript was the only widely-used, successful, and convenient web programming language regardless of the shortcomings it came with. Several number of alternatives were introduced but they were either proprietary products, had little cross platform support, or required browser plugins.

However, WebAssembly has been successful where others have failed, and so instead of replacing JavaScript, it works alongside with it. WebAssembly code runs within a low-level virtual machine that mimics the functionality of the many microprocessors upon which it can be run. Either through Just-In-Time (JIT) compilation or interpretation, the WebAssembly engine can perform at nearly the speed of code compiled for a native platform.

Where will it be used?

WebAssembly is to be used in various different fields, some of the prominent ones being games, VR, and augmented reality. Most of the current WebAssembly demos use the Unity or the Unreal Engine. There are still a lot of problems to solve, like better timing guaranteed for data intensive real time apps. We’ll also be seeing apps that stream big channels of data through networks of processing functions. These are traditionally things that most people don’t think of when they think of JavaScript.

We will also be seeing its use in recording and encoding audio, encoding videos, rendering 3d objects in real time, re-encoding images on the fly, editing and annotating PDFs, creating a fully feature text editor, doing real time simulation of physics and visualizing data in real time.

What exactly is the WebAssembly in layman terms?

· It is basically an improvement to the already existing web programming language JavaScript and can be imported into a standard JavaScript module.

· It is a compile target which provides a way for other languages to get first class binary support across the entire web platform stack.

· An improvement to the browsers as the browsers will understand the binary format, which means that we will be able to compile binary bundles that compresses the data smaller than the text JavaScript we use today. Smaller payloads mean faster delivery. Depending upon the compile-time optimization opportunities, WebAssembly bundles may even run faster than the JavaScript.

Summing up with it's Pros:

  • Efficient and fast - The WebAssembly stack machine is designed to be encoded in a size and a load time efficient binary format. It aims to execute at native speed by taking advantage of common hardware capabilities available on a wide range of platforms.
  • Open and debuggable - One of the biggest problems with the compiled JavaScript was the difficulty of debugging and profiling, due to the inability to correlate between the compiled code and the source. With WebAssembly, we have a similar issue, but it's being addressed by making it possible to support truly great tooling by exposing low-level capabilities instead of prescribing which tooling should be built.
  • Safe - WebAssembly describes a memory-safe, sandboxed execution environment that may even be implemented inside already existing JavaScript virtual machines.