6
votes

I'd like to try and improve the performance of my app for certain tasks. There are a few ideas I'd like to try out but I'm not sure how I can quantitatively measure 'before' and 'after' performance.

What is the best way to do this on WP7? It would be nice if I could do this both on the emulator and a device.

Thanks for your help, Ashish

EDIT:

I am mainly concerned with page load times. The app reads an XML file from isolated storage and populates a ListBox. Currently I'm using XDocument and LINQ to read the entire file before populating the ListBox.

I'd like to switch to using XmlReader and adding items as they are read. Ideally, the reading would happen in a separate thread, and I'd add the items one at a time (or maybe a handful at a time if that has better performance) to the ObservableCollection that the ListBox is bound to.

Thanks for the answers so far, I'll look into both the profiler and high resolution counter to time the operations.

3

3 Answers

5
votes

There are a couple of things you can do.

I found this post particularly useful. http://www.geoffhudik.com/tech/2010/10/9/basic-windows-phone-7-diagnostics.html

Also, if you have specific frame rate issues that you want to track try something like is explained here: http://www.jeff.wilcox.name/2010/07/counters/

If it is simple timing improvements I would use a more high resolution timer than the DateTime object as josh suggested.

The Stopwatch class will give you more accurate timings

3
votes

The EQATEC WP7 Profiler will give you good timings on how your improvements are going, it'll also help you decide on where to focus on future improvements. I've only used the free version but it's certainly helped a lot.

1
votes

If you're talking about timing you can do instantiate a DateTime before the operation and then get the run time after it finishes and do the same for the new code.