Editor’s Note : Gregg Pollack, a well-known name in the tech circle, is the founder of Code School, one of the premier online code-learning platforms. Have a go on his views about WebAssembly, in this post, exclusively penned down for The Tech Portal.
There have been a number of efforts to evolve the web as a platform over the last 15 years, from Macromedia with Flash to Microsoft with Silverlight. These attempts have all been geared to allow enhanced applications to be written for the Web, but most develops I know say they’ve failed. Enter WebAssembly.
The WebAssembly Difference
Well, first and foremost WebAssembly being worked on by all the big browser makers: Google, Microsoft, Apple and Mozilla are all on board. WebAssembly is also tied in closely with JavaScript
Web as a “Platform”
Companies like Google have been doing everything they can for the last 10 years to convince developers that the Web is the best place or “platform” to build applications.
Developers can choose to build apps on the Windows platform, OS X platform (to run on a Mac), or they can write them for the Web platform. However, one of the biggest issues with this is that certain applications (like gaming) require a lot of processing power.
A developer who wants to write cutting edge games is going to get more performance writing for Windows or OS X, commonly referred to as writing a “native” app. With the WebAssembly language, the performance of Web platform games may get a lot closer to native.
How it Works
WebAssembly will allow developers to write faster applications in the same way Ruby and Python language developers currently do. Both are beautiful programming languages, but their applications are almost always slower than compiled languages like C.
Let’s say, for example, you’re a Ruby developer building an app that takes an image and outputs that image into multiple sizes, and you want to do this really fast. You’d likely find a library written in C that you could call from your Ruby code for the resizing, and you’d get a nice speed boost. Now let’s say that you’re a JavaScript developer building an app in the browser that does the same thing.
If you wanted to do the image resizing in someone’s browser using JavaScript, you could but it might be painfully slow. There’s no way to speed it up other than to move the processing back onto the server side, out of the browser and perhaps using an aforementioned method with Ruby or Python.
With WebAssembly, this scenario is about to change. In the future you’ll be able to take that existing C image processing library, compile it into WebAssembly code, retain much of its speed and efficiency and then ship that code along with your JavaScript into someone’s browser. Just like Ruby called C to perform faster, JavaScript will call your WebAssembly library to perform faster – all within a browser.
Once WebAssembly is more prevalent, it is likely there will be many open source WebAssembly libraries that JavaScript developers can include and send to someone’s browser to create faster web pages. Along with the previous example of image processing, WebAssembly could also speed up things like games, music and video applications, virtual reality applications, simulations, visualizations and so on.
Another way to understand the potential impact of WebAssembly is through an existing application like video editing. Currently, to effectively edit a video you have to download a native (Mac OS X or Windows) application. A video editing application in the browser would be much slower because of the limitations of JavaScript.
With WebAssembly, the browser performance of a video editing application will get a major speed boost. Will it rival the speed of native? There’s no way to be sure yet, but it’s definitely going to get a whole lot closer.
It’s important to note that WebAssembly will not replace JavaScript. At Code School we believe that it’s now more critical than ever for developers to continue to hone their JavaScript skills. And this is why we recently launched JavaScript.com as a resource to the developer community.
Because WebAssembly is a low-level language that isn’t ideal for coding, most developers will still be writing JavaScript for their Web applications as usual. Then to optimize small parts of their app, they will call out to open source WebAssembly libraries.
WebAssembly could truly evolve the Web as an application platform. I look forward to seeing how things unfold.