Tuesday, September 4, 2012

Low memory phone performance

So, the Marketplace Dashboard update almost made it through testing!  The biggest problem turned out to be it's performance on low-memory phones like the Nokia Lumia 610.  I was surprised since I knew that it ran fine, but it ended up being more subtle than that.

First of all, you should know that background agents won't run with 256MB phones.  For that reason I was already hiding the option for that on those devices (and feeling pretty smug about it!).

Lumia 610 (256MB RAM)
Second, with low memory, not as many things can run in parallel.  Due to the way apps are exposed on the Dev Center, I have to make a service call for each one.  On a 512MB device, I can run 10 threads concurrently and it goes pretty nicely.  On the 256MB device, the threads queued up the same way, but with them running in parallel they went so slowly that the timeout value often ended up being hit.  To make it worse, it ran just fast enough in the emulator.  We developers are supposed to keep in mind the difference between the emulator and a real device, but it's not necessarily obvious how to account for it.  Since I don't have a low-memory device, I had to trust the emulator.  Since it worked, I assumed the best!

Bottom line, it's not just peak memory that you need to worry about.  With less memory, things can run slower.  If you are using timeouts, you should probably increase those too.  Unfortunately, that part's going to be hard to test on the emulator.  You can only do your best though!  Being aware of this might save you some frustration later.