Optimizing Windows Phone 7 Applications (Part 1)

Atanas Dyulgerov / Friday, October 7, 2011


When developing applications for a mobile platform, one needs to keep in mind more things than when they are doing development for a PC or a webpage. Performance optimization matters a great deal more then as the phone is not a computer and thus its hardware resources are limited. Modern mobile phones are light years away from what they have been in the recent past, but still despite of the quite impressively sounding specifications, the available resources do not give us the freedom not to take advantage of every possible opportunity to speed up our apps. 1GHz processor sounds like a lot for a phone, but in reality a phone with 1GHz processor is not as fast as a PC with 1GHz processor. The phone does not have virtual memory or swap file and a lot is going on in the background.

In addition to the limited hardware resources, the mobile platform differs in having a very dynamic networking environment. Phones change their networks relatively often – 3G to 2G, Wi-Fi connections that drop from time to time, etc.  In addition to that, the speed is sometimes is quite slow. If our application is not optimized for such environments, the user will be easily aggravated. 

The size of the screen is also a factor. Because its resolution is small, there will be inevitably lots of transitions and animations between screens, which in turn lead to consuming more resources. With phones, the main method of user inputs is the finger touch. This leads to selection of objects on the screen that is not that precise and new selection logic is needed that would take into consideration whether the user has clicked or swiped, for example. 

Another thing not to be underestimated is the fact that the emulation that is bundled with Visual Studio uses the resources of the computer it runs on, not the resources of the phone. As a result, the applications that we develop work several times better on the emulator than on the actual mobile devices. This is why we have to jump on every possible opportunity to improve the performance of the applications that we develop and be constantly on the look for potential issues.

The most common performance-related problems of Windows Phone 7 applications are the following: slow scrolling of lists with many elements; choppy (not smooth) animations; the UI is slow to respond to touch; the screen coming to complete hang for some time; slow application start; the big size of the application makes it slow to download from the Marketplace, etc. However, the most important factor that we need to have in mind when developing mobile applications is the way the user perceives the performance of the app, not the way it actually performs. Example: if we have a list with 1 000 000 sales and we want to visualize them on the screen, it would be much better and more appealing to the user if they load in 10 seconds during which time there is an indication of what is going on instead of loading in 5 seconds with the UI completely unresponsive for that period. The user must always be kept informed about what is going on whenever there is a time consuming operation taking place.

This was the first of a series of blog posts on the topic. In the next two posts, I’ll discuss how to deal with these common problems and with other potential issues. I hope this post was useful. Have a great day!