When you purchase through links on our site, we may earn an affiliate commission. Here’s how it works.

Mozilla speeds up calls between JavaScript and WebAssembly in latest beta

Mozilla has announced that calls between JavaScript and WebAssembly code have been dramatically sped up in the latest version of Firefox Beta. While calls from WebAssembly to JavaScript were already pretty fast taking about 600 milliseconds to execute 100 million function calls, it has been improved to take less than 400 milliseconds. The real improvement is seen when JavaScript calls WebAssembly functions though.

According to Mozilla’s figures, executing 100 million WebAssembly function calls from JavaScript had used to take just under 5,500 milliseconds, or 5.5 seconds, they now take just under 500 milliseconds or 0.5 seconds. The benefit of this refinement will be seen when running pages that rely on WebAssembly, including some browser-based games.

Mozilla had previously been using C++ to help the WebAssembly code understand the JavaScript code being passed to it. In order to improve the speed it decided to cut out the middleman; the firm said:

“We took the code that C++ was running — the entry stub — and made it directly callable from JIT code. When the engine goes from JavaScript to WebAssembly, the entry stub un-boxes the values and places them in the right place.”

Mozilla also improved the speed of calls made to built-in browser functions from WebAssembly, as well as monomorphic calls from JavaScript to WebAssembly. If you’re interested in getting a better understanding of the inner workings of the change, be sure to check out Mozilla's blog post which includes cartoons and simpler language so that everyone can get a roundabout understanding of a complex topic.

For those just interested in the results, this change means that your browser will be a lot faster when it comes to executing WebAssembly calls from JavaScript, making browser-based gaming more feasible in particular.

Report a problem with article
Next Article

Microsoft rolls out the October update to Slow Ring Office Insiders on Mac

Previous Article

Microsoft is reportedly finalizing deal to acquire Obsidian

Join the conversation!

Login or Sign Up to read and post a comment.

6 Comments - Add comment