Will Firefox beat IE9 to Direct2D rendering?

It was a principal element of the Day 2 keynote at Microsoft's PDC 2009 conference last week in Los Angeles: an early demonstration of code being worked into Internet Explorer 9 that replaces the browser's outdated reliance upon the (very) old GDI rendering library, with new code utilizing Direct2D -- a library that borrows processing power from the GPU. But with the project only having begun last October, it could still be several months before Microsoft creates still more features to make IE9 worthy of a point-release.

By that time, Mozilla could very well have absorbed Direct2D capability into Firefox, if it accepts the contribution of engineer Bas Schouten. By modifying a recent daily build of the organization's "Minefield" track for Firefox 3.7 Alpha 1 for Windows, Shouten was able to graft Direct2D support onto the browser, which also usually relies on the old GDI library. The results were Web pages that were as instantaneous to the eyes as the demos we saw of Direct2D rendering on IE9 test code last week.

In a personal blog post Sunday, Schouten discussed some of the difficulties he faced in working Direct2D rendering capabilities onto Mozilla's "Cairo" graphics engine -- difficulties peculiar to Firefox that IE9's developers may not be troubled with: "Direct2D has been implemented as a Cairo backend, meaning our work can eventually be used to facilitate Direct2D usage by all Cairo based software. We use Direct3D textures as backing store for all surfaces. This allows us to implement operations not supported by Direct2D using Direct3D, this will prevent software fallbacks being needed, which will require readbacks. Since a readback forces the GPU to transfer memory to the CPU before the CPU can read it, readbacks have significant performance penalties because of GPU-CPU synchronization being required. On Direct3D10+ hardware this should not negatively impact performance, it does mean it is harder to implement effective D2D software fallback. Although in that scenario we could continue using Cairo with GDI as our vector graphics rendering system."

Although the improvements in on-screen rendering are not something our Betanews CRPI JavaScript performance suite would be able to track, those performance hits Schouten mentioned are indeed something we could see. In tests this morning on Windows 7 RTM using last night's private build of Firefox 3.7 Alpha 1, versus Schouten's remodeled build, the Mozilla build posted a CRPI 2.2 score in Windows 7 of 13.88 -- the best score turned in by a Mozilla browser to date -- versus 12.31 for Schouten's version. At least for now, the rendering improvements come at a cost.

But can those improvements more than make up for the implementation cost, which at the moment Betanews estimates to be about 12.8%?

Betanews tests this morning revealed the answer, quite surprisingly, to be no. Compared to the current daily Firefox 3.7 Alpha 1 build, timing the page loads for 28 major Web sites on Windows 7 RTM, the Schouten build with Direct2D installed only rendered pages about 5.2% faster than the Mozilla build, according to a geometric mean of the differences in render times. The Schouten build only renders 7.3% faster overall than Internet Explorer 8 by that same formula, which is not even close to the speed gains we saw on Microsoft's own in-house tests of Direct2D on IE9 code last week.

Where the Schouten build did see gains was on very content-rich sites such as the Chinese Web portals, such as qq.com and xunlei.com. But that build also crashed for one of those sites -- sina.com.cn -- and it also crashed for plain old, American aol.com, for reasons we couldn't ascertain. (Perhaps it doesn't like the new branding campaign either.) For content-light pages such as Google and Ask.com, the Schouten build was measurably slower than both the Mozilla build and IE8. It's worth noting here that IE8 is very competitive against Firefox in render times for sites with moderate content, and even on a few sites with heavy content (the Chinese portals, for instance). However, when the content load gets great or when content may be composited from multiple sources (as appears to be the case with Blogger.com), IE8 becomes exponentially slower, with some load times exceeding one minute.

Your eyes may tell you the Schouten build renders faster -- as ours did right at first -- but that conclusion may derive from the feeling of speed you see from a page appearing all at one time. The test build may actually be much faster at snappy rendering, but that's not the entire job; in fact, the page loading portions of our CRPI tests indicate that the test build may actually be slower at that part than the Mozilla build.

Integration is the key to making Direct2D work in place of GDI in the browser; and if this early test build is any indication, Microsoft could be further along in this process than Mozilla after all.

© 1998-2019 BetaNews, Inc. All Rights Reserved. Privacy Policy - Cookie Policy.