SpiderMonkey Newsletter (Firefox 118-121)

SpiderMonkey is the JavaScript engine used in Mozilla Firefox. This newsletter gives an overview of the JavaScript and WebAssembly work we’ve done as part of the Firefox 118 to 121 Nightly release cycles.

The team wishes you Happy Holidays!

🚀 Performance

We’re working with other Firefox teams to improve performance for popular web frameworks such as React. This work is largely driven by the Speedometer 3 benchmark that Mozilla is collaborating on with other browser vendors. The Performance Team recently gave a talk all about Speedometer 3 at the performance.now() conference.

We can’t list all of our improvements here, but the list below covers some of this work.

  • We’ve added JIT optimizations for property accesses involving proxies. As described in this Mozilla Hacks post, this significantly improved performance on the Vue.js 3 framework.
  • We added more optimizations for Object.assign.
  • We’ve changed how some Baseline IC stubs are allocated to use less memory and to be faster.
  • Array destructing has been optimized with a fast path in the bytecode.
  • We improved JSON parsing to help avoid GC time when parsing very large files.

We also partially fixed a long-standing performance issue with the DevTools Web Console: if the JS code doesn’t use any of the special console variables, it will now run as fast as regular JS code on a website.

⚡ Wasm GC

We’re shipping WebAssembly GC in Firefox 120! 🎉 This is a large feature that makes it possible for high-level languages to compile to WebAssembly and use the browser’s garbage collector. The Wasm GC proposal adds struct and array types to WebAssembly for this.

If you’re using Firefox 120 or later, you can try this demo of a Kotlin image viewer or this Dart/Flutter demo. Both of these use Wasm GC.

👷🏽‍♀️ Other features

We’re also shipping Wasm tail calls in Firefox 121. This is an important feature for functional languages such as OCaml or Scheme that rely heavily on tail recursion.

We also shipped some new JS features in Firefox 119:

Additionally we will be shipping the Promise.withResolvers proposal in Firefox 121.

We implemented some features that are still disabled by default:

⏰ Date parsing improvements

The JS language specification does not define which date/time formats have to be accepted or rejected when converting strings to Date objects. This has resulted in a number of web compatibility issues because there are subtle differences between the date parsers of most JS engines.

Vinny Diehl has volunteered to improve compatibility with other browsers. Here are just a few of these changes:

  • We now accept dates with a period after the month.
  • We accept more numeric dashed dates, for example 1-1-2024.
  • We now support milliseconds in more cases.

The release notes for Firefox 121 (and earlier versions) list more cases.