What are some performance tips when making Windows Phone 7 applications?
As performance is very important for Windows Phone 7 application development I am starting this question so that we can collect here some helpful performance tips.
Gen开发者_JAVA技巧eral:
Performance Considerations in Applications for Windows Phone
Articles:
Performance Tips when creating WP7 apps
Performance of Windows Phone 7 Applications
Performance Considerations for Windows Phone 7 Games
Videos:
Optimizing Performance for Silverlight Windows Phone 7 Applications
Windows Phone 7 Jump Start (Session 17 of 19): Optimizing for Performance
Silverlight Firestarter 2010 - Performance Tips for Silverlight Windows Phone 7
Samples:
Creating High Performing Silverlight Applications for Windows Phone Samples
General
- If your app loads very fast get rid
off the spash screen. - Code generation in the compact framework is not the same as Windows’ code. Jitter is optimized to run fast, not to produce the fastest code.
- Property is just a function for .Net CF.
Silverlight
- Take as much as you can from Compositor Thread (for callback animations use BitmapCache).
- Use Canvas or custom popup instead of default one (Popup class) – lack of hardware acceleration.
XNA
- Use DXT format for textures and pack them into 1 file (faster loading and fewer GPU texture switches).
- For things like game stats avoid using strings( immutable). SpriteBatch.DrawString can take a StringBuilder directly for drawing text.
- Avoid using/abusing LINQ and foreach (it may causes garbage). Use Jagged arrays( arrays of arrays) instead of 2d arrays.
The #1 performance enhancer I've found for my apps, especially for animations that use the UI thread, is to manually set BitmapCache for all UIElements. This significantly improves all animation.
I found this some days ago WP7 best practices - Performance
Its mostly commented links to articles (some of them mentioned before) and sources (like Jeff Wilcox Performance Progress Bar).
And remember: Listboxes are like kryptonite to WP7 performance =)
精彩评论