First look: Firefox 7 slashes memory usage

Mozilla debuted
Firefox 7
just six weeks after Firefox 6, thanks to its
rapid release cycl
e. One of the most significant improvements is a reduction in memory use -- by as much as 50% in some cases, Mozilla claims. Users who keep lots of tabs open and leave their browser running for long periods of time will reap the benefits of Mozilla's MemShrink project, which is dedicated to improving Firefox's speed and stability by reducing its memory usage.

Among the changes for web developers in Firefox 7 are: upgraded support for web sockets; support for the Navigation Timing spec, which lets developers monitor parts of web page performance in the page itself; and a faster Canvas element. The new release also fixes some stability issues and incorporates a number of bug fixes. A new opt-in tool lets users send anonymous performance data to Mozilla, which is aimed at helping developers isolate places where Firefox is slow.

Mozilla engineers have been working hard to shed the browser's reputation for being a memory hog, in large part through the MemShrink effort. Firefox 7 is the first release to benefit from its successes, writes Firefox developer Nicholas Nethercote in a
blog post
:

"Firefox 7 uses less memory than Firefox 6 (and 5 and 4): often 20% to 30% less, and sometimes as much as 50% less. In particular, Firefox 7's memory usage will stay steady if you leave it running overnight, and it will free up more memory when you close many tabs. This means that Firefox 7 is faster (sometimes drastically so) and less likely to crash, particularly if you have many websites open at once and/or keep Firefox running for a long time between restarts."

New rendering backend to speed up Canvas operations on Windows systems

Mozilla is working on a new graphics API dubbed Azure that will be used for rendering in its Gecko engine. In Firefox 7, it's being used only with Direct2D and when using Canvas, which allows the team to stress test the new API, says Firefox developer Bas Bchouten
in his blog
: "The bottom line is you should generally see a speed improvement using 2D Canvas in Firefox 7 when using Windows 7 or Vista with a sufficiently powerful graphics card."

One easily visible difference in Firefox 7 is the loss of the http:// URL prefix in the address bar. It's now hidden by default for a cleaner, more streamlined view of the URL. Secure prefixes such as https remain visible.

Firefox 7 features Mozilla's initial implementation of the
Navigation Timing spec
, which allows a web page author to monitor parts of web page performance in the page itself, Mozilla's Blizzard explains. "For people who are interested in page load and navigation performance, they can send that back to the server which can give them a better view into real-world performance," Blizzard
blogged
. Screenshot from the W3C Editor's Draft shows a script that calculates how much time it takes to load a page since the most recent navigation.

Traditional tools for measuring performance, including benchmarks like SunSpider, don't do a very good job of measuring when Firefox is slow, says Mozilla developer Asa Dotzler. What's needed is real-world usage that reveals where code is slowest, and for that, Mozilla introduced an opt-in feature, called Telemetry, in version 7. Dotzler
explains in his blog
:

"Telemetry in Firefox is a new technology that allows our developers to build performance tests right into Firefox itself and to have those tests running while users are interacting with Firefox and the Web. These little tests, also called probes, should go completely unnoticed when you're using Firefox but they make note of the time it takes to accomplish certain tasks like establishing a network connection or freeing system memory. If people opt in to sending this anonymous data to Mozilla, like tens of millions do with crash reports already, then our developers can isolate places where Firefox is slow or uses too much memory and can start to remedy them."

Screenshot shows some of the data that Mozilla is gathering from users who opt-in to telemetry.

The WebSocket protocol has been disabled in Firefox in the past because of security issues, but the new version of Firefox implements the most recent draft version of WebSocket (version 8, as specified by IETF draft 10). Mozilla also has enabled the WebSocket protocol by default in Firefox for Mobile. "For mobile networks that are high-latency and have high connection setup-up costs, WebSockets offers an opportunity to create a much better experience than is available with polling HTTP," writes Mozilla's Blizzard.

Firefox now supports the
ellipsis mode
for the text-overflow property, which is used when text content overflows its given layout area. Screenshot shows Christopher Blizzard's example of how text-overflow ellipsis works. "As you can see, it's pretty easy to make text that cuts off in a sane way with this new property," Mozilla's Blizzard
blogged
.

Among the changes in Firefox 7 that affect web developers is expanded support for MathML, an application of XML for describing mathematical notations. Here's how Mozilla
summarizes the change
s:
* XLink href has been restored and the MathML3 href attribute is now supported. Developers are encouraged to move to the latter syntax.
* Support for the voffset attribute on <mpadded> elements has been added and behavior of lspace attribute has been fixed.
*The top-level <math> element now accepts any attributes of the <mstyle> element.
* Support for Asana Math fonts has been added.
* The medium line thickness of fraction bars in <mfrac> elements has been corrected to match the default thickness.
* Names for negative spaces are now supported.
Screenshot shows source code required to render the Pythagorean Theorem