Windows Phone 7 performance Monday, June 14, 2010

Because I don’t have a device to use in order to test my Windows Phone 7 application and the emulator cannot emulate performance, I found a great session at Tech-Ed with the best practices in order to get better performance in your apps. Then I applied where I learned there to my code and use the emulator. This are the tips I got, let’s share it with the world, when the devices start coming into the market you don’t want to find out your application performs badly on those devices. I personally like to test it on a Intel Atom Netbook computer, if performs good there, I can assume that will perform well on the ARMS processor.

To enable the Performance counter you need to use

Application.Current.Host.Settings.EnableFrameRateCounter = true

Should be 60 frames per second, this are the counters to keep an eye at:

Render Thread frame rate

UI Thread frame rate

Amount of VRAM used by App

Total # of Textures on GPU

# of Intermediates

To enable the Dirty Regions counters.

Application.Current.Host.Settings.EnableRedrawRegions = true;

Practices to drive performance for Windows Phone 7

Indentify potential problem areas Startup, memory, framerate

Monitor as changes are made Framerate, size of Dirty Regions

Less is more Slim Visual Trees Collapse items that are not visible Z order doesn’t count Avoid small property changes or use the render thread animation.

Minimize UI thread work

Leverage Off threads

Leverage GPU Use simple animations of Simple properties Cache Avoid large textures

Caching CacheMode = BitmapCache will cache the rasterized version of a UIElement and its children Silverlight auto-caches animation when possible, Don’t count on it, verify it.



Media

Video (MediaElement) Rendered in Render thread Must be cached. CacheMode required in earlier builds, not required later, but it is being applied. Still, less is more: Right size Minimum frame rate possible.

Images Decode in Software



Start Up

Use a splash screen include applicationsplashscreen.jpg



Delay loading resource at start-up only and load other resources when needed.

When submitting into the market place one of the things that you going to check is starting time. So make sure your application starts fast, try to avoid including many resources on your application, just download the as needed.

Performance pitfalls

SW-only features Non rectangular clips Opacity mask do not use it.



Hope you keep in mind all those while you writing code, I’m doing the same thing for all my WP7 development.

Cheers

Al