开发者

Windows Phone 7 - Best Practices for Speeding up Data Fetch

I have a Windows Phone 7 app that (currently) calls an OData service 开发者_如何学运维to get data, and throws the data into a listbox. It is horribly slow right now. The first thing I can think of is because OData returns way more data than I actually need.

What are some suggestions/best practices for speeding up the fetching of data in a Windows Phone 7 app? Anything I could be doing in the app to speed up the retrieval of data and putting into in front of the user faster?


Sounds like you've already got some clues about what to chase.

Some basic things I'd try are:

  1. Make your HTTP requests as small as possible - if possible, only fetch the entities and fields you absolutely need.
  2. Consider using multiple HTTP requests to fetch the data incrementally instead of fetching everything in one go (this can, of course, actually make the app slower, but generally makes the app feel faster)
  3. For large text transfers, make sure that the content is being zipped for transfer (this should happen at the HTTP level)
  4. Be careful that the XAML rendering the data isn't too bloated - large XAML structure repeated in a list can cause slowness.
  5. When optimising, never assume you know where the speed problem is - always measure first!
  6. Be careful when inserting images into a list - the MS MarketPlace app often seems to stutter on my phone - and I think this is caused by the image fetch and render process.


In addition to Stuart's great list, also consider the format of the data that's sent.

Check out this blog post by Rob Tiffany. It discusses performance based on data formats. It was written specifically with WCF in mind but the points still apply.


As an extension to the Stuart's list:

In fact there are 3 areas - communication, parsing, UI. Measure them separately:

  • Do just the communication with the processing switched off.
  • Measure parsing of fixed ODATA-formatted string.

Whether you believe or not it can be also the UI.

For example a bad usage of ProgressBar can result in dramatical decrease of the processing speed. (In general you should not use any UI animations as explained here.)

Also, make sure that the UI processing does not block the data communication.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜