Apps chrome

JavaScript web apps aren’t going anywhere

Most websites and web applications are written in JavaScript, or at least something that is converted to JavaScript. There have been many attempts over the years to change this, but don’t expect JavaScript to completely disappear anytime soon.

Zaplib is a startup that created a framework to rewrite parts of JavaScript-based web applications in the Rust programming language, which would then run in web browsers using WebAssembly. Rust is a low-level programming language optimized for performance and security, and many applications have used Rust to dramatically improve load times and responsiveness. Mozilla rewrote the Firefox web browser’s CSS engine using Rust in 2017, as part of the “Firefox Quantum” update, which doubled typical Firefox performance. WebAssembly allows sites to write their code in more traditional programming languages, like C++, and run it in a web browser, just like JavaScript.

Zaplib hoped that rewriting web applications in Rust-powered WebAssembly, one section at a time, would lead to a performance increase of up to 10 times. However, the company’s founders said in a “post-mortem” that the massive jumps didn’t quite happen. “Our bet was that it would be 10 times more user-friendly to speed up your application, incrementally, in Rust. It didn’t hold up in real-life implementations,” the team said.

The group noted some problems with their plan. Most companies were (understandably) reluctant to rewrite their code in a language their engineers might not know, but more importantly, there was no significant speed difference between good JavaScript code and good JavaScript code. Rust. Zaplib helped a company port a simulation tool to Rust, which ended up being only 5% faster than the existing JavaScript version. Zaplib also hoped its hardware-accelerated 2D renderer would help, but most of the performance boost came from WebGL, which doesn’t need Rust or WebAssembly at all.

That doesn’t mean WebAssembly is terrible or useless — Google Earth and Photoshop have both been ported to web browsers thanks to WebAssembly, and companies like Microsoft are creating frameworks for more developers to make the same transition. There’s absolutely a reason it exists, but JavaScript has also evolved significantly over the past few years. The “V8” engine that handles JavaScript code in Chrome, Microsoft Edge, and other Chromium-based browsers is getting faster and faster. According to Google, recent optimizations have made Chrome the fastest web browser available on Mac, and other changes have also speeded up Windows and Android versions.

WebAssembly is already bringing a new wave of applications to the web that couldn’t have existed a few years ago, but don’t expect all JavaScript to disappear anytime soon. Zaplib said in their post, “there are usually easier ways to find performance improvements than Rust [or WebAssembly].”

Source: Zaplib