Google, Microsoft, and Mozilla Announce ‘WebAssembly’- A Faster Web Standard
JavaScript is the programming language for most of the things on the internet. Web apps and webpages hugely rely on JS (JavaScript). Though JS is not the ideal programming language out there, it has become the standard of the web, but it will soon have a new challenger in the form of WebAssembly.
JS has a lot of limitations and the developers around the world have been continuously working on overcoming them by building JS transcompilers (which convert code from one language into JS code).
Microsoft has developed ‘TypeScript’ while Mozilla has its ‘asm.js’ project for adding new features to JavaScript. Combining many of such projects together the developers have come up with WebAssembly, which is in collaboration with Microsoft, Google, Mozilla, and the engineers from the WebKit project.
WebAssembly allows the programmers to compile their code for browsers in one language (it is C/C++ as of now) which is then executed inside the JS engine of the browsers. WebAssembly can decode the code a lot faster as it doesn’t have to parse the full code at one go.
When implemented in all web browsers, WebAssembly will provide the developers with a single compilation target for the web, and hence will become a new standard of the web.
JS files are text files which are downloaded from the web server along with the other elements of a web page. These files are then parsed and compiled the JS engine of the web browsers, which takes a lot of time.
WebAssembly on the other hand is in binary format which can not only be compressed more than the JS text files, but can also be decoded much faster. For instance, WebAssembly’s current prototype is 23x faster than parsing Mozilla asm.js code.
WebAssembly not only meets the target set by Mozilla’s asm.js for a super-fast web, but also offers the same functionality. Further, the developers would also be able to use the same tools they use for compiling asm.js code and WebAssembly code.
WebAssembly team mentions that the idea is not to replace JavaScript but to allow many more languages to be used for the web. We may soon see webpages employing both these languages for driving a better user experience. We seldom see such big competitors working together on something.
So whatever might be the case, WebAssembly has to have a lot of potential.
WebAssembly seems exiting since it can decode the code a lot faster as it doesn’t have to parse the full code at one go.