Archives
- Newer posts
- November 2024
- April 2024
- November 2023
- October 2023
- August 2023
- May 2023
- February 2023
- October 2022
- August 2022
- July 2022
- May 2022
- April 2022
- March 2022
- February 2022
- June 2020
- March 2020
- February 2020
- January 2020
- December 2019
- November 2019
- October 2019
- September 2019
- August 2019
- July 2019
- June 2019
- May 2019
- April 2019
- March 2019
- February 2019
- January 2019
- December 2018
- November 2018
- October 2018
- September 2018
- August 2018
- July 2018
- June 2018
- May 2018
- April 2018
- March 2018
- February 2018
- January 2018
- December 2017
- November 2017
- October 2017
- September 2017
- August 2017
- July 2017
- June 2017
- May 2017
- April 2017
- March 2017
- February 2017
- January 2017
- August 2016
- June 2016
- April 2016
- March 2016
- February 2016
- January 2016
- July 2015
- June 2015
- Older posts
WebAssembly
Since the dawn of time, native applications have always delivered a larger-than-life performance compared to web applications. Any web application could never enable or scale to the full functionality of the device expected from apps like games, multi-media intensive apps, high data processing apps, etc. JavaScript wasn’t designed to be fast for very large applications.
“WebAssembly (or Wasm) is a binary instruction format for a stack-based virtual machine.” Wasm is a portable platform to compile high-level languages like C & C++ to be deployed on the web. The code will execute at speeds previously achieved by assembly programs. Web assembly doesn’t replace the way the web works; JavaScript will not be replaced, but rather an improvement to it.
Wasm is aimed to be efficient & fast. Web assembly includes a stack machine that encodes the code in load-time efficient binary format. This allows it to achieve native speeds. Web assembly is a sandboxed environment that guarantees safety of your device. It also will not allow cross-origin that makes the device vulnerable.
Wasm is built as a binary format. It’s very compact to download and also very efficient to compile & execute. Wasm enables speed in 2 areas; first in app start-up speed (2x or more) and secondly in throughput (compiled code runs faster). With Web assembly, we can now have real 64-bit integer data type, more control over memory management & smooth performance throughout the application.
With Wasm, developers across spectrums can bring their native C or C++ applications to the web & reach efficient performance capabilities of the device. This in-turn means no downloads, malwares, etc. as there is no need for installation on the device.
Implementing Wasm in our web project is a sequence of simple tasks:
- Write source code in your preferred high-level language (C, C++, Rust)
- Compile it into WebAssembly (will output a .wasm file)
- Include this .wasm in your web project
- Write Async JavaScript code in your web project to compile & execute the .wasm
Wasm is a revolutionary technology. It’s community keeps improving and adding new features at alarming speeds. Wasm is not the only technology of such nature; but it is the one backed by W3C and major company like Microsoft, Google, Apple, etc. Only time will tell what is in store for the future.