« Cheap and Easy WPF clr-namespace references. | Main | Adobe Illustrator CS3 Installer »

CompositionTarget performance

From Rob, Composition Target.Rendering and minimized Windows.

From: Helpful MS Employee 
The CompositionTarget.Rendering event puts us into a mode where we continuously animate. You should unhook at every opportunity.

The key thing to never forget about using the Rendering event -- it continuously fires, unlike any typical UI development system -- the more you do, the slower it goes. Win32 WM_PAINT messages only fired when a region became invalidated (i.e, it needed to be refreshed). Even WPF doesn't work that way normally -- as it's a retained mode drawing system -- the "OnRender" method only fires when you want it to (controlled by a number of factors of course). 

This event however, fires many times a second -- for example, it could easily fire 60 times a second!

Help support my web site by searching and buying through Amazon.com (in assocation with Amazon.com).