Search for:

It’s not only faster, but it’s also so much faster! Almos 20% faster.

If you use WebAssembly, you might be able to get a response in 8ms rather than 10ms.

Something that people never really get is that much of the time spent waiting for a page has nothing to do with JavaScript.

There’s a lot of other things to take into account are such as:

  • Poor page design
  • No minimizing network requests
  • DOM rendering time

JavaScript is very rarely the bottleneck for the page speed. So, to update the above example it might take a page to render in 899ms instead of 900ms.

At the cost of a lot of working porting the code to C++, which would be a lot better spent optimizing the page where it will help.

There are though a lot of use cases where WebAssebmly can be way faster. It would be useful for games, which are more often than not written in C++ anyway.

But for the most part, WebAssembly just means “you can compile C++ for use in a web page”.

Other people have mentioned earlier that you can’t yet manipulate DOM from WebAssembly, but a lot of stacks already exist that handle that particular issue. And there are countless languages that compile to JavaScript, so if JavaScript were such a terrible language, wouldn’t we be seeing the rise of one with solid modern engineering principles? Oh yeah, we are TypeScript.

As mentioned above, the majority of websites are slow but not because of JavaScript. 

So, even if you could manipulate the DOM from WebAssembly and ported the code to C++, you would hardly even notice the difference in speed.

Aside from DOM and some network issues, the next most common problem is the algorithm being used. Making your code almost 10x faster just by changing the algorithm from JS to C++ is amazing, but making it 100x faster just by changing the algorithm in JavaScript a bit is a lot less work for a better result.

So, the main reason why we’re still using JavaScript and compile-to-JavaScript languages like TypeScript?

It’s easier. It’s more powerful. It’s fast enough, and the ecosystem is amazing. Except for areas like games and specialized libraries. 

So, in conclusion, we don’t see WebAssembly making a dent in the foreseeable future.

Write A Comment