There’s a question which has been doing rounds in the developers’ community from quite some time now: “Will WebAssembly define the end of JavaScript?”
A common speculation is that WebAssembly flags the end of JavaScript, but the creator states otherwise. Brendon Eich, Creator of JavaScript and former CEO of Mozilla, claims that WebAssembly intends to complement JavaScript and not replace it. It is designed to perform tasks that JavaScript was forcefully made to do earlier, and that is, representing a low-level code that can pass as a compiler target.
Do you agree with what Brendon has to say on this? Do we? Is WebAssembly going to be the Grim Reaper for JavaScript?
Let’s get into more on JavaScript and WebAssembly first:
a) Enabling linguistic diversity:
To build front-end tools and applications, WebAssembly expands the accessible languages, allowing web developers to develop web applications in any language that they pick. C/C++, C#/.Net, Java, Elixir, and Python are some of the major languages that WebAssembly supports, apart from other 20+ languages in the list. This assortment of languages leads to the expansion of web frameworks for app developers, allowing them to directly create applications in their chosen languages.
b) Enabling parallelism:
New and fresh tools enable some amount of parallelism in JavaScript but still prove to be challenging at some levels. Given that WebAssembly’s threads feature is still in its draft phase, developers will be able to create web applications that will benefit from fine-grained parallelism, once the proposal becomes a reality.
c) Enabling rapid web application development:
WebAssembly has impressed with the speed of web development boosting overall performance. WebAssembly’s binaries are smaller in size than textual JavaScript files, hence, it is much easier to download. The time to initial load has also improved big time. Run-time performances improved as well which work in favor of large projects. Frameworks and libraries built with WebAssembly allow developers to benefit from these speed boosts while the primary development with JavaScript persists.
Don’t forget to check: 8 Interesting Javascript Frameworks and Libraries.
Of course, you want to know more…
According to an article published by Unity Technologies where they compared Safari 11.1.2, Chrome 70, Edge 17, and Firefox 61, WebAssembly powers through in the following ways:
- Both Chrome and Edge experience super-fast loading speed using WebAssembly.
- With WebAssembly, almost all browsers (excluding Safari) load more rapidly as compared to asm.js.
- All browsers perform in the same manner on Windows, when using WebAssembly.
- But when it comes to macOS, Firefox performs better than other browsers using WebAssembly.
- Safari does not support asm.js optimizations, and hence, gains benefits the most from WebAssembly.
How will JavaScript benefit from WebAssembly?
Time to get back to the original questions. Well, WebAssembly does compliment JavaScript. All features that are packed within JavaScript have a scope to grow and improvise. There are high chances of having better techniques in JavaScript and more low-level APIs. WebAssembly, as we expect, will possibly enable JavaScript to implement Augmented Reality and Virtual Reality, multi threads, native compilation support, excellent graphics, etc.
JavaScript is not out of the picture, guys!
The competition is bound to increase as more and more languages enter the market, but just like Node.js which survived a hard time in the server side web and still emerged as a favorite, JavaScript will evolve on. Whatever the situation in this area be, web development is expected to have a bright and prosperous future.
Working with WebAssembly does not mean throwing JavaScript out of the window. Despite the future plans of enabling WebAssembly modules to be loaded exactly like EcmaScript 6 modules, JavaScript is here to assist WebAssembly. As WebAssembly doesn’t have a way in to any platform APIs, JavaScript is clearly needed. WebAssembly opens the door for creativity and innovation for JavaScript actually. It might sound like a diplomatic alternative to ‘JavaScript got to improve in a more challenging environment’, it is not. Or may be… ?
Resource: Telerik, Void Canvas, ZenDev, Auth0, Unity