Windows 7 GDI performance: the trade-off

office-bms-simple

Yesterday I noted that our Office benchmark runs surprisingly slowly in the Windows 7 RC. Today I’ve been digging around for an explanation.

The first step was to see whether the slowdown affected all Office applications equally, or whether it manifested mainly in one application. This was easily tested with a stopwatch, and the results were pretty clear: the Access, Excel and Word tests completed in effectively identical times in Vista and Windows 7 RC... but the PowerPoint test took more than three times as long in Windows 7.

Look, here's that same information in graph form:

office-bms-simple

What was slowing PowerPoint down? The benchmark wasn’t stalling at any particular point. Rather, it seemed to suffer from a generally hobbled draw rate. With Vista I'm used to seeing our test slides flash past at tremendous speeds, like some sort of corporate blipvert; but in Windows 7, running on the same hardware, the more complex images took an appreciable fraction of a second to render. Since our benchmark uses hundreds of such slides, that was enough to explain the difference in execution times.

Updating the drivers

It looked like a classic graphics driver problem. The drivers for our ATI Radeon HD 4550 had come from Windows Update, so I downloaded ATI’s new WHQL certified Windows 7 drivers, installed them and repeated the benchmark. No change.

Just to be certain, I whipped out the ATI card and replaced it with an Nvidia GeForce 8500GT. Identical results again, regardless of whether I used the drivers provided by Windows Update or the latest package from Nvidia.

This year's model

On the face of it, this is mysterious. Windows 7 uses the new Windows Display Driver Model 1.1, which is supposed to perform more efficiently than the WDDM 1.0 found in Vista. Hell, its superiority is obvious as soon as you start dragging transparent windows around on a low-spec PC. So you’d expect rendering in PowerPoint to be faster, not slower.

But if you look into the actual changes involved in WDDM 1.1 (there are some good details at the Windows 7 Engineering Blog) it’s apparent that there’s an element of trade-off involved. Let me pull out a few pertinent sentences from that blog link:

In Windows Vista, every GDI application window accounts for two memory allocations which hold identical content – one in video memory and one in system memory. [. . .] Windows 7 saves one copy of the memory allocation per application window by getting rid of the system memory copy entirely. Thus, for a GDI application window visible on the desktop, the memory consumed is cut in half. [. . .]

The elimination of the duplicate system memory copies [leads in some cases to] reduced performance as the CPU now has to read data back from the video memory. [. . .] Our observation has been that these slow-downs do not impact the end-user functionality directly and that the memory savings directly result in Windows 7 being much responsive overall.

To me this sounds like a very plausible explanation for the effect I’ve seen. It’s easy to believe that PowerPoint’s graphical routines involve lots of inefficient CPU-based operations – I mean, that’s what it looks like when it’s running.

And, in fairness, I think Microsoft is right to make this trade-off. In the real world, a small delay in switching slides is unlikely to cause too much bother (although it would arguably be a good thing if it did discourage people from using PowerPoint). It's probably a price worth paying for the nippy Windows 7 front-end.

Back to the old school

But what if you rely on an application that's more severely affected? I can easily picture a specialist CAD or modelling application slowing to a crawl with Windows 7 drivers. And since the performance trade-off is by design there's little hope of a fix. What then? Is there a way to regain the performance of Vista? (There's a question I never thought I'd ask.)

The answer is pleasingly simple. Since Windows 7 is designed to be backward-compatible with Vista, you can just install a Vista graphics driver, which of course will still use WDDM 1.0. And guess what?

office-bms-drivers1

Yep, installing WDDM 1.0 drivers on Windows 7 brings GDI performance back up to speed. (In fact I found the combination slightly faster than Vista, but don't read too much into that - I'd need to repeat the tests several more times to be sure that small variation wasn't just down to background services, caching etc.)

I tested Vista drivers under Windows 7 with both ATI and Nvidia cards and the results were identical. Sure, the old drivers are supposedly less efficient, but I didn’t observe any difference in responsiveness or RAM usage, even when I opened up twenty concurrent Explorer windows.

OK, it's not a perfect solution, nor even a very neat one. And as developers get to grips with the new OS, choosing Vista drivers may mean missing out on Windows 7-specific benefits.

But still, it's good to know what's going on.

Read more

Blogs