• Home
  • Blog
  • WebAssembly – power hidden in browser


WebAssembly – power hidden in browser

31.05.2019 - Read in 6 min.

Did you know that WebAssembly is used in the development of blockchain applications? Or that despite its young age, on numerous levels it beats JavaScript and asm.js in terms of performance?


Did you know that WebAssembly is used in the development of blockchain applications? Or that despite its young age, on numerous levels it beats JavaScript and asm.js in terms of performance? Do you realise that your apps written in C or C++ can be used in web browsers? With no need to rewrite them to JavaScript? Do you know that an app2, the code of which has been developed for the last 30 years, has already done that thanks to WASM?
Or maybe you’ve been thinking about sharing your game, created in Unity
or Unreal Engine, to a broader audience through web browsers?

A bit of history…

JavaScript was created in 1995 by Brendan Eich, at that moment with Netscape. It’s a monopoly in the category of programming languages supported by web browsers. JavaScript has gone an incredible way to become the language we all know today. Engines like Chrome V8 perform miracles in the area of just-in-time compilation (JIT), but JavaScript still struggles to achieve native performance in web apps. In 2013, Mozilla released asm.js, i.e. a JavaScript subset comprising a minimalistic set of functionalities (e.g. it does not contain the “for” loop). It ensured higher performance thanks to compilation of an app before it was run, and static typing.

The need for performance

Recent years have brought us many technologies that develop at an astonishing pace. Trends among users suggest a growing need for mobility and “constant availability” of favourite platforms and apps. In 2016, the number of users connecting to the Internet with the use of mobile devices exceeded the number of those using PCs. Accessing apps only at home, from a PC, becomes a thing of the past. Excel or Word documents can now be edited online. Browsers have become a kind of an operating system. The world moves online, but to make it possible, performance is a must. Addressing the needs of users and developers, in March 2017 W3C released WebAssembly (WASM) – second ever programming language (apart from JavaScript) and first binary language supported by web browsers.

Native performance for everybody

I’m sure we all remember Adobe Flash, Java applets, or not-so-distant PNaCL

(Portable Native Client), i.e. attempts to take over the Internet by a technology other than JavaScript. What differentiates WebAssembly from the above-mentioned technologies is the fact that WASM is embedded in browsers just like JavaScript, and it’s officially a part of the web standard resealed by W3C. Flash and Java applets relied on plug-ins, and they were never an integral part of browsers, but just an artificially “attached” creations. On the other hand, PNaCL is only available in Chrome. For over a year, Google has been working to move Google Earth from PNaCL to WebAssembly, which will increase the performance and above all will allow users to access this product from any browser.

This opens a whole new perspective to companies that have been creating apps limited by a particular environment they were intended for.

How Autodesk used WebAssembly

An excellent example of using WebAssembly is Autodesk, who has been trying multiple times to introduce its flagship product Autocad in a web browser. There were numerous attempts – Flash, HTML5+JavaScript. Due to the costs of moving the entire code for such a large product like Autocad, and the performance needed to ensure fluent operation in a browser, the Autodesk team kept failing. At the moment, the web version of Autocad uses its own engine written in C++. Recompiled to WebAssembly, and thus eliminates the unknown, i.e. the potential performance of the app rewritten to JavaScript. This lack of predictability of JavaScript is presented on the diagram below.​