Get that play on "Avengers assemble" title?!! All jokes aside, recently while I was browsing the web for technologies and study materials regarding the front-end development, I came across this term called "WebAssembly." I remembered hearing it a while back but did not get a chance to dig into it. In this blog, I want to discuss the information I found in regards to "WebAssembly" and some of the use and functionalities that WebAssembly can be utilized.
So what is WebAssembly exactly? Here is the definition I found on webassembly.org.
"WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable target for compilation of high-level languages like C/C++/Rust, enabling deployment on the web for client and server applications. "
Okay... So what exactly does this mean? A simple explanation is that WebAssembly essentially is a technology that can be used to run any language in or close to native speed in modern browsers. The one language that is designed to run in native speed in browsers without the help of WebAssembly is JavaScript. With WebAssembly, you can pretty much write in any programming language such as C++ for applications and WebAssembly is going to compiled it into a bytecode format that can be run in web browsers which pretty much opens up a whole new world of possibilities for writing applications that can be run in the web.
WebAssembly might seem like a technology that is used to replace JavaScript altogether but not quite. It is actually designed to work alongside JavaScript and in fact some of the modules in WebAssembly actually requires JavaScript to run.
For quite a long time that JavaScript was the only language that could be run in native performance in the browsers. Then HTML and CSS were both adapted to be in the same way as JavaScript in terms of being the web standards. On December 5th of 2019, WebAssembly has become the 4th language to run natively in the browsers which really speaks to the significance of establishing WebAssembly as one of the few web standards.
What makes WebAssembly performs in native speed in web browsers is that all the code written by the developer are compiled in WebAssembly ahead of time before they are sent to the browser. Since the code has already been parsed to a low level machine code, it is easier for the browser to just read, validate and run the code without having the browser to do the heavy-lifting of processing and running. Which is why it is sometimes faster to run WebAssembly bytecode than regular JavaScript code.
What are some of the uses for WebAssembly? The most common uses of WebAssembly are parsing and compiling applications that require strong processing and computational power such as online games with 3D graphics, videos and music editing as well as augmented reality and virtual reality applications that JavaScript just does not have the processing power to support are some of the apps that are good for WebAssembly to handle. WebAssembly provides ways to bring applications that are traditionally operated on their own domains to the web which provides incentives for developer to bring their applications to web in terms of only needing to deal with one platform and the code is easier to support and maintain.
Some high level recaps of the advantages of programming with WebAssembly:
- Able to develop web applications in languages other than JavaScript.
- Bringing applications that are traditionally operated on their native domains to the web.
- WebAssembly runs in major browsers and platforms.
- WebAssembly does not replace JavaScript and it runs alongside JavaScript.
- WebAssembly is portable and efficient. Can produce modular binary code.
Here is a really helpful article explaining how to create WebAssembly instance with JavaScript. Feel free to check it out if you are interested in how the browsers work with JavaScript and WebAssembly.
Conclusion
After searching and digging around the web for information on WebAssembly, it is not hard to see the buzz around WebAssembly because of the possibilities of bringing applications to the web that are not native to the platform. Being able to develop applications with languages that are not traditionally possible for web applications can really change our perception of what web applications can be in the future. It is exciting and encouraging and I am looking forward to see what the future holds for WebAssembly.
References
https://webassembly.org/
https://developer.mozilla.org/en-US/docs/WebAssembly
https://en.wikipedia.org/wiki/WebAssembly
https://medium.com/mozilla-tech/why-webassembly-is-a-game-changer-for-the-web-and-a-source-of-pride-for-mozilla-and-firefox-dda80e4c43cb
https://hackaday.com/2019/04/04/webassembly-what-is-it-and-why-should-you-care/
Top comments (0)