Friday, July 8, 2011

Firefox Posts Huge Memory Improvements

Firefox users have been complaining about excessive memory usage of the browser for quite some time, but it appears that the company is now successfully addressing those concerns as JavaScript memory usage has been improved by 20 – 30%.
Browsers are becoming more and more the centerpiece of our computers, which is why we are much more particular about the value and performance they deliver. A key focus these days is how the browser interacts with low-end systems such as tablets and netbooks, products that are basically made for Internet browsing. A critical issue has been memory usage for quite some time as especially Firefox spent the available budget excessively and occasionally drowned an entire system with its overly generous approach of using memory.

 

Not surprisingly, memory optimization is turning into a big deal at Mozilla and we are seeing more and more information trickling through from Mozilla developers such as Gregor Wagner and Nicholas Nethercote. While catching memory leaks has been a focus for Mozilla QA for some time and while the team has sponsored memory leak hunts in the past, Mozilla has made it both more efficient and easier to spot leaks just recently. I participated in those hunts in the past and witnessed how elusive memory leaks really are: Is it a leak, or is it just a dynamic process that just hasn’t gone through garbage collecting yet? What if there is a timer on it which leaves a footprint for a little while after the process has been closed?
Mozilla’s latest “memory multi-reporter interface” helps analyze memory leaks. This new version of about:memory is available on all latest Nightly and Aurora builds and it reveals both a more detailed overview of what process is using how much memory on a device and provides the tools to try and detect memory leaks in a much more efficient way. It also enables users to “garbage collect” (the process in which a browser releases non-occupied memory) manually and reduce memory usage. So, if Firefox is running slow, pop into about:memory and hit one of those buttons at the bottom and you will see an improvement.

Optimizations for Firefox 7
Of course, in a perfect world, you shouldn’t have to go anywhere or press anything in order to get Firefox to work right. Mozilla has made some progress in that direction and recent optimizations have been made to the Firefox engine to account for many JavaScript memory problems.
Mozilla said it has capped memory leaks and added some interesting and apparently effective enhancements as well. “Reduced JavaScript heap fragmentation” is a new feature that you will get when you take the recent nightly builds (Firefox 7/8) for a spin.
Similar to how your hard drive works, JavaScript is stored in chunks. Each chunk is 1 MB in size. The problem is that core JavaScript Firefox will not be removed until after the browser is closed, meaning that while a garbage collect may remove any evidence of your last Facebook visit, as long as a tiny part of any given chunk contains a core eliminate in it, that chunk will continue taking up space. These little buggers add up. Gregor Wagner grouped the entire core elements in one part and all the site elements in another to prevent both from mixing. This approach minimizes the number of chunks Firefox needs to use for its core components and completely clears the site components – which translates in a 100% efficiency after you close out of a tab: The idea is that your memory usage is the same before opening a certain tab and after closing this tab. According to Mozilla, this feature can lead to a reduction of over 5 times in JavaScript heap sizes. In some cases, this can be more than30% of your entire memory usage. Needless to say, this can be quite a bit.
Add that to the fact that the native garbage collection triggers have been improved to work not only on chunk pile sizes, but timers as well. The result is a much more efficient Firefox browser, at least as far as memory usage is concerned.
Improving memory is not a feature that is quite as tangible for users as a UI change. However, it is significant progress for the Firefox core and it is the kind of innovation that makes Mozilla special. Firefox’s memory consumption has been a very strong argument against the usage of the browser for a long time. It’s good to see Mozilla listening and fixing this issue.


Michael Rabinovsky in Products on July 06

No comments: