1. Home >
  2. Internet & Security

Mozilla puts Firefox on a memory diet

At any one time, SpiderMonkey's memory footprint can be over 50% of Firefox's total usage -- but hopefully, that's about to change.
By Sebastian Anthony
Firefox logo (huge)

Firefox's single largest consumer of RAM, its JavaScript engine SpiderMonkey, is going on the mother of all diets. At any one time, SpiderMonkey's memory footprint can be over 50% of Firefox's total usage -- the JavaScript on the ExtremeTech homepage, for example, uses no less than 115MB of memory -- and slipstreaming SpiderMonkey is by far the best change that Mozilla can make to keep Firefox on the desktop svelte and competitive with Chrome and IE, and Firefox on Android less sluggish.

If you're not a programmer, you should probably skip this paragraph. Basically, almost every fundamental part of SpiderMonkey(Opens in a new window) is being torn apart, turned over in the hands of Mozilla's finest engineers, and rejigged to use less memory. JSObject is being cut in half, and thus JSFunction will also be slimmed down. Slots arrays will have the option of being 32-bit, rather than being forcibly being constructed of 64-bit "fatvals." Shapes, one of SpiderMonkey's most important data structures, are going to be almost halved in size. Mozilla is currently looking into whether scripts can be "lazily loaded," too -- as much as 70-80% of all downloaded JavaScript is never executed, and so it makes no sense to load it into memory; lazy loading, where scripts are loaded as-needed, would significantly reduce memory usage.

Nightly FirefoxLast but not least, TraceMonkey -- JaegerMonkey's ancestor and in the words of Mozillan Nicholas Nethercote "a big hairball" -- is being retired. No one will miss it, RAM usage will be lowered, and Firefox itself will be a smaller download. JaegerMonkey, as of Firefox 10 or 11, will be the sole just-in-time (JIT) compiler.

Now, it's important to bear in mind that a lot of this work is on-going -- the currently Nightly build (version 10) seems to actually have a slightly larger JavaScript memory footprint than the release build of Firefox (version 7) -- but when all of these changes eventually land (probably in time for Firefox 11 -- about four months away), and if you factor in other changes currently being made to Firefox's memory consumption, Firefox's RAM footprint could be a third of what it is now.

Read a complete list of the planned changes at Nicholas Nethercote's blog(Opens in a new window), and take a Nightly build for a spin to see the improvements(Opens in a new window)

Tagged In

Javascript Surfing Firefox Spidermonkey Web

More from Internet & Security

Subscribe Today to get the latest ExtremeTech news delivered right to your inbox.
This newsletter may contain advertising, deals, or affiliate links. Subscribing to a newsletter indicates your consent to our Terms of use(Opens in a new window) and Privacy Policy. You may unsubscribe from the newsletter at any time.
Thanks for Signing Up