WASM: Killer Of JavaScript?
WASM stands for Web Assembly, it to the book is a binary instruction format for a stack-based virtual machine. It is designed as a portable compilation target for programing languages to enable their deployment on the web for the client and the server side applications. It offers a new type of code in compact binary format which can run on “Near” native performance speed.
It also provides a compilation target on the web to languages like C/C++ and C#. It is rumored to be called the “Killer Of JavaScript” by some developers but in actuality is designed to and can run very well alongside it, even its own creators deny this. The main pillar on which the argument stands is the fact that JavaScript was not developed to be a “good” compilation target, whereas WASM is.
Compilation Target: A compiler in essence is a translator which translates one language(Higher Level Programing Languages, easily understood by humans) into another(Lower Level Programing Languages, difficult to be understood by humans).
How JavaScript works is that it is send over the network as it is without getting compiled so data like comments, indentations, License etc. is sent over the network as well, this leads to a huge wastage of data. It is not that this implementation is bad or wasn’t thought of while development, the simple fact is the time was different when JavaScript was developed than it is now and its developers must have thought against spending a fortune on a feature which even then seemed a unnecessary to many. WASM on the other hand is a good target compilation thus it can run well on the existing JavaScript based machinery. Thus it is more likely to evolve as a feature of JavaScript than its replacement.
Features Of WASM
- Quick and Efficient: The WASM is a stack machine designed to be encoded in a load-time and size efficient format. It aims to be executes at native speed by taking advantage of available hardware capabilities.
- Secure: WASM uses a memory-safe, sandboxed environment for execution and can even be implemented inside the existing JavaScript Virtual Machines.
- Open And Debug Able: WASM is designed to be “pretty printed” in a textual format open for Debugging, Testing and Optimizing, making it a great chance learning.
- A part of the Open Web Platform: WASM is designed to maintain the web’s version less and backwards-compatible nature.
A Game Of Numbers
The Simple fact remains is that our world runs on numbers and not on ideal conditions. JavaScript has been around for a couple of Decades with a thriving community of some of the Best Developer in the world and a technological and monetary dependency that it is already running on a vast array of Machines, WASM on the other hand has been introduced just a few years back, is riddled with Bugs, compared to JavaScript has a small number of practitioner and community members and needs to replace a large number of Technologies to replace JavaScript which is an economic nightmare for companies. Thus it is more likely to either grow as a feature of JavaScript than it’s replacement or to be out paced by the JavaScript Developers who in a bid to save their language introduce the best of both worlds in JavaScript itself.
However the idea that WASM can replace JavaScript is not that far fetched either, if a large enough number of people understand what WASM offers and what it can be, developers won’t be far behind to learn and put this new skill under their belts. Companies realizing the wastage they had been facing, driven by the race to achieve higher profits may very well adopt this new technology.
Best Of Both Worlds
Developer can use WASM and JS together bringing both of their advantages under a single umbrella while avoid their shortcomings as they complement each other perfectly. WASM can be run alongside JS using WASM JavaScript APIs. This will load the WASM modules into a Web-App and share the functionalities together. This way the developers gets the benefit of vast community, expressiveness and flexibility of JavaScript while the Clients get the superior performance and power of WASM.
Conclusion
WASM’s ability to slay and replace is debatable and up to the Tech Giants and Developers, however the Internet users can definitely expect an inherently superior Internet Experience. With the increased capabilities of WASM developers will be able to run much more complex programs on the browser making it possible for us to run heavy software and games on browser itself. Saving us space and distributors resources to produce expensive consoles and memory devices.