Open In App
Related Articles

WebAssembly – The next BIG thing!

Like Article
Save Article
Report issue

Very soon, JavaScript would not be the lingua franca for the web. As some of the big players like Google, Microsoft, Mozilla, Apple, etc. along with W3C have teamed up to create a brand new standard called WebAssembly. The good thing, It will be supported by all browsers. 

So, What WebAssembly stands for? 
Officially, WebAssembly or wasm is a new portable, size- and load-time-efficient format suitable for compilation to the web. It is a new binary format for the web. It writes applications for the Web and languages other than JavaScript. It includes a low-level language similar to an assembly that can be represented with text then converted to a binary format that runs on all modern browsers however you won’t write this code directly but rather use it as a compilation target for programs written in other languages.

Why WebAssembly is needed? 
JavaScript is robust and useful. Like any other language, it is not a suitable fit for solving all problems. 

For many years, many companies were trying to fix up the shortcoming of JavaScript in their own ways by extending it such as asm.js (Mozilla), typescript (Microsoft), NACL (Google). Now, these projects and companies have come together along with W3C to provide a solution called WebAssembly. With Emscripten, other languages can be compiled or transpired to JavaScript but still, JavaScript is the main target of these not VM. With WebAssembly, the need to transpile to JavaScript is removed but goes down the low level of system equivalent to bytecode.

Imagine a world where you can build software with C++, Rust, Python, Go, or even COBOL the deliver that software to the end-user in a Web browser without any installation and near-native performance, that world became a reality in December 2019 when web assembly became an official W3C standard.

You might build a game with Unity and C# then compile it to the web assembly where it can be delivered in the browser. Now, it’s important to note that it’s not intended to replace JavaScript in fact the two work well together side by side, Figma for e.g. uses React.js for its outer UI than on the inside you have a high-performance C++ design tool that feels just as fast as native software.

Web development is itself a challenging part where things are rapidly evolving and WebAssembly will be a new addition. With this, we may see the web used in a lot of new applications which is not possible in today’s scenario. WebAssembly will open more doors by freeing up from the shackles of today’s web. 

WebAssembly is very flexible to use and supports languages like- .Net, AssemblyScript, Astro, Brainfuck, C, C#, C++, Clean, Co, COBOL, D, Eel, Elixir, F#, Faust, Forest, Forth, Go, Grain, Haskell, Java, JavaScript, Julia, Idris, Kotlin/Native, Kou, Lobster, Lua, Lys, Never, Nim, Ocaml, Perl, PHP, Plorth, Poetry, Python, Prolog, Ruby, Rust, Scheme, Scopes, Swift, TypeScript, Wah, Walt, Wam, and Zig.

Benefits of WebAssembly over JavaScript – 

  1. Write performance-critical code using other languages like c/c++. 
  2. WebAssembly can be natively decoded much faster than JavaScript can be parsed. 
  3. It loads significantly faster on mobile devices. 
  4. Sharing of code between applications. 

Is this the end of JavaScript? 
A BIG NO! JavaScript has enough inertia to drive the web for the next decades. While WebAssembly will allow more languages to be compiled to the web, JavaScript is here to stay. WebAssembly will boost JavaScript by complementing it, applications written in WebAssembly will also be able to integrate with JavaScript. The fact that JavaScript is giving enough competition to established back-end languages with Node.js, proves that JavaScript is still strong and will continue. Meanwhile, it is best to stay with JavaScript and learn about its new features. JavaScript also has got new exciting features in the pipeline like pthreads, simd. 

WebAssembly is still in its infancy. Only time could tell us how it will evolve. For some time being wasm and asm.js will stay equivalent to support polyfilling of wasm via JS. After that wasm and JS may diverge. To bring a new standard into the web will be as tough as exciting it sounds. But the upside is that we now have an open, vendor-neutral, cross-browser, experience-based standard, commitment, and involvement to major open-source implementation on the web. 

My blog post

Last Updated : 19 Feb, 2021
Like Article
Save Article
Share your thoughts in the comments
Similar Reads