Wed. Dec 11th, 2019

Mozilla optimizes to WebAssembly and JS in Firefox

1 min read

Mozilla’s latest Firefox browser beta Firefox Nightly can call the WebAssembly binary format and JavaScript faster, so it’s easier to combine the two languages.

WebAssembly can be a companion to JavaScript in web development, taking on performance-intensive tasks. But so far, slow function calls between the two languages have hampered the combination of the two. Firefox Nightly beta makes these calls run faster than non-inline JavaScript-to-JavaScript function calls. The call has been optimised from JavaScript to WebAssembly and vice versa. Mozilla also speeds up calls from WebAssembly to built-in functions, which are functions provided by the browser, such as Math.random.

Firefox will disable all legacy add-ons

There are two types of optimisations for WebAssembly and JavaScript calls:

  • Reduction of bookkeeping by eliminating unnecessary work to organize stack frames.
  • Bypassing of intermediaries, by taking the most direct path between functions.

Mozilla has recently worked hard to improve the speed of WebAssembly, mainly in optimising throughput and load time. Plans require embedding WebAssembly into JavaScript. Currently, the only optimisation call from JavaScript to WebAssembly is no faster than a JavaScript-to-JavaScript call. JavaScript has a built-in function. In-lining provides a shortcut to functions that call the same function over and over again.

Via: InfoWorld