Mozilla Rust Web

Empowering Your Web Applications with WebAssembly

There’s no doubt that JavaScript and other popular web-based programming languages like Python, Java, C++, C# have made a significant impact on the web landscape. While new programming languages come and go as we progress through the digital age, it’s also fair to say that many of the popular ones are here to stay. Let’s consider JavaScript for a moment. There are currently an estimated 1.7 billion websites online right now[1], and around 95% of them used JavaScript as a client-side programming language in some form[2]. JavaScript’s place in internet history can’t be understated, but at the same time, it’s not a perfect language. This is where WebAssembly comes in.

What Is WebAssembly?

Put simply, WebAssembly is an open standard that defines a portable binary code format for executable programs. It essentially allows you to write code in other programming languages like Rust, C/C++, GO, and others; and compile them to run on the browser. WebAssembly’s power lies in its ability to execute code at native speed, allowing for an extremely fast and efficient experience. With WebAssembly, you get to experience the advantages of your favorite programming languages while benefiting from the power and performance of the Web, and all without having to learn a new language.

WebAssembly can now be run in most modern browsers including Chrome, Safari, Firefox, and Edge.


What Is The Purpose Of WebAssembly?

The purpose of WebAssembly is to empower web applications through better speed, performance, and optimization. Every browser interprets and executes code through a JavaScript engine. While a JavaScript engine may be perfectly suitable in a lot of instances, it isn’t ideal in all situations, and this is where WebAssembly offers a significant advantage. The low-level binary format allows for smaller app bundles, essentially meaning it’s smaller in size, so faster to execute. It’s also statically typed and uses linear memory, both adding to its increased speed.

How JS parses WASM
Source: Lin Clark © 2017.

There’s a thriving community of developers putting WebAssembly to use today. For example, there’s a fun browser game called Funky Karts written in WebAssembly, a WebAssembly pathfinding demo, a 2D character animation program, and much more. WebAssembly is a great choice when it comes to games. Let’s say you have a  casual game that players want to hop onto when they have a few minutes of downtime. Casual games are there to provide fast and light entertainment, so users must be able to start the game straight away. Due to its power and speed, WebAssembly lends itself well to this task, getting games started quickly. It also works well for AAA games that have heavy assets that historically may suffer from speed problems.

« Zen Garden » by Epic Games

However, it’s not just in quirky games and image editing that WebAssembly thrives. It’s not a program with a niche set of applications, but rather a new way of doing things that has the potential to shift every element of the web experience. Inside the browser, WebAssembly can be used to provide better performance for CAD applications, music applications, on interactive education software, with VPNs, with live video augmentations, and the list goes on.

How Web Assembly Will Empower Your Web Applications

We live in the digital age where we expect faster and faster responses from our web applications. Gone are the days that you would wait patiently for a low-resolution image to load section by section, all the while hoping no one jumps on the phone thereby cutting your connection. We now have increasingly powerful, dynamic, and almost futuristic web applications that we couldn’t contemplate even a decade ago. Of course, this explosion in powerful web apps all ties into the data boom we have been experiencing in the last 5 years. It’s now easier than ever to capture and analyze large chunks of data that we can use to fuel powerful web and AI programs.

What Are The Implications Of WebAssembly?

When discussing what WebAssembly is and it’s potential to empower web applications, it’s also important to discuss what it isn’t. WebAssembly isn’t intended to be a replacement for JavaScript or any other web programming language. Its goal is to bring more power to JavaScript applications so they can perform at a higher level and you can get the most out of your applications. With WebAssembly, you aren’t forced into choosing a new programming language, you can use JavaScript and WebAssembly in conjunction to empower your JS app. There are many areas where JavaScript struggles to perform in the ways that modern web applications and their users demand, and it’s in these situations that we can assign WebAssembly to resolve the problem.

WebAssembly does all the heavy lifting in the browser so JavaScript can do what it does best. For example, you can build in high levels of expressiveness into your apps with JavaScript, but then have them run at extremely fast speeds using WebAssembly. Certain large and powerful applications will send huge numbers of calls to the server to do heavy calculations. Not only does this affect speed and performance, but it just doesn’t make for good optimization when WebAssembly can do it better. WebAssembly optimizes the process so that the heavy calculations are handled directly on the browser, making your application faster and safer.

So what about the future? Is WebAssembly the future? There’s been a lot of buzz surrounding WebAssembly over the last couple of years leading to more and more developers taking notice. And when developers take notice, they start developing! That’s where WebAssembly is at right now. There’s been a huge increase in use cases for WebAssembly and the list continues to grow.

Speed is undoubtedly an important factor when it comes to any application or technology, but it’s especially true when considering larger, more technical, and more powerful applications. However, it’s not ALL about speed, but also flexibility, functionality, and optimization. This is where WebAssembly really sets itself apart from other speed-boosting projects of the past. One huge perk of WebAssembly is that it expands the types of programs that can be delivered on the web, essentially allowing for a more diverse and robust user experience and web landscape.



Mozilla Privacy Rust

Open Days 2018 was a blast!

« Open Days », an event about ICTs and the promotion of free software involving Hi-Tech stakeholders was held in the auditorium of the Alliance Francaise of Toamasina.

Open Days is a yearly event that happens in Toamasina. It is organized by JADE and this year, Mozilla Madagascar participated by hosting 3 talks during the event. This year, we talked about Virtual Reality, Rust and Privacy.

A week of training on the « Dev Boot Camp » was offered to enthusiasts from 16 to 23 November 2018, followed by a lively weekend of sharing, conferences, demos, distribution and exchange on 24 and 25 November.

On the evening of November 23rd, the Mozillians set off for Toamasina for their presentation session scheduled for Saturday, November 24th at 2:30 pm. It was a few minutes later that Mozilla’s team spoke to the participants.

The presentations lasted almost 2 hours, followed by a question and answer session. The topics we discussed were: Online Privacy, Rust and WebVR.

Online Privacy

The first topic presented by Mariot and Mihaja was about Online Privacy. Since most of the participants were CS students or students that were already familiar with the Web, it was not a difficult task. But one thing that most of the audience were surprised by was the trackers. They knew about their existence but didn’t know at which extinct they were following and stalking them.

The first part of the session was a simulation of a normal browsing experience (shopping, social media…). During that part, we asked the participants what do they do the most on the web. We also asked what kind of data about do they share willingly. The second part was showing them what data about them has been shared without their knowledge or consent. We showed the companies that had access to their data and what do they do with it. The third part was to teach them how to limit the data that they share willingly and how to protect their privacy online.

We noted during that session that many people were surprised by the amount of data that companies had on them. We are proud of ourselves because we feel that this session helped a lot of people and many pledged to educate their family and friends about these.


The next session was about Rust and it was presented by Felixie and Mariot. This was a little more difficult because Rust is still a relatively new technology. But we think we still managed to pull it up 🙂

The session was aimed at people who already had some programming background. There wasn’t an extensive training on the language itself, but we presented what makes the language different and what are the features. We were happy because there were a lot of questions asked and the participants were really interested.

Felixie talking about Rust tools

We were advised to present a more in-depth session next year, during the Boot-camp. We found that idea a really good one so we are already preparing that.

WebVR with A-Frame

The last session that we presented was about Augmented Reality with A-Frame. Christino was is charge of that one because he has a lot of experience about it.

The goal was to make the participants aware of the new advancements in WebVR and how to use them. The easiest tech in that domain is A-Frame. So we did an introduction to A-Frame and did some demos. Then, the participants were taught the basic principles of it with a step by step tutorial.

This session was very successful because it was such a new thing for them and A-Frame was so easy to learn! It was great 🙂

Tino pendant la présentation

What we could have done better

The sessions and presentations went all smoothly and we fulfilled our wishes for that event. But there were also some things that we could have done better. Here’s some of them.

  • Make sure to have all the intels before filing a budget request bug
  • Made all the reservations way in advance
  • Write the blog post as soon as the event finishes

I filed the bug request by copying an old bug (because the event was the same). This was a bad idea because the context and the sessions were not the same. I should have just filed a brand new bug request.

For the reservations, we should have made them wayyy in advance. By not doing so, we got stuck with less choices when traveling or getting an hotel. Especially since there were a lot of tourists in the city at that time.

This blog post comes a long time after the event. This was caused by a lot of procrastination from my part. This is problem that I partly solved by setting goals for each task that I should do in a day. I also rustused a technique that I just learned: The Pomodoro Technique