Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Windows Phone 7 - Real World Performance Challenges

2,791 views

Published on

The presentation focused on performance challenges I've come across when working on real-world WP7 applications using Silverlight. These challenges include optimizing startup time of applications, using ListBox with a large number of items, serialization / deserialization, working with images, accessing the network and realtime drawing on the screen.

  • Be the first to comment

Windows Phone 7 - Real World Performance Challenges

  1. 1. WP7 Performance Challenges<br />GergelyOrosz<br />@GergelyOrosz<br />
  2. 2. WP7 Performance Challenges<br />My Experience<br />Everyday performance challenges<br />Visually rich app performancechallenges<br />Computing intense performance challenges<br />
  3. 3. My Experience<br />
  4. 4. Cocktail Flow<br />
  5. 5. Cocktail Flow Challenges<br />Serialization / Deserilaization<br />Animations<br />Downloading packages: networking<br />Rich ListBoxes<br />Emulator vs physical device<br />
  6. 6. Visiblox Charts for WP7<br />
  7. 7. Visiblox Charts for WP7 Challenges<br />Avoiding overloading of the UI thread<br />Realtime drawing on the screen<br />How fast can you draw on the phone?<br />Memory Leaks<br />Data binding<br />DPs<br />
  8. 8. EverydayPerformance Challenges<br />
  9. 9. Networking & the UI<br />Question<br />
  10. 10. Networking & the UI<br />WebClient: simple, easy<br />… runs on the UI thread!<br />HttpWebRequest: complicated &performant<br />
  11. 11. Serialization & Deserialization<br />XmlSerializer<br />
  12. 12. Serialization & Deserialization<br />Binary Serialization<br />DataContractSerializer<br />Json.NET<br />sharpSerializer<br />Mike Talbot’s Silverlight Serializer<br />Sterling Isolated Storage DB<br />Ninja Database Pro<br />
  13. 13. Serialization & Deserialization<br />Load<br />Save<br />
  14. 14. ListBox<br />Cool in the beginning<br />Rusty when you start adding stuff<br />Awfully slow when you start tweaking visuals<br />Pain to make it half as fast as on the iPhone<br />
  15. 15. ListBox<br />Slow with > 50-200 elements<br />Virtualized, but….<br />Several workarounds<br />Windows Phone Team: ListBox best practices<br />3rd party Listbox (Telerik)<br />Implement paging<br />
  16. 16. Emulator vs Physical Device<br />Emulator usually 2-5x times faster<br />GPU intensive tasks: emulator can be slower<br />Test (frequently) on the device<br />
  17. 17. Small Things<br />ProgressBar<br />Splashscreen while loading<br /> PerformanceProgressBar<br />
  18. 18. Visually Rich App Performance Challenges<br />
  19. 19. Frame Rate Counters<br />FPS (render > 30, UI > 15)<br />Texture mem. usage<br />Fill Rate (<2.5)<br />Blog post explaining these<br />
  20. 20. BitmapCachevs No Caching<br />No caching  GUP calculates every time<br />BitmapCache  “screenshot” saved, no GPU needed<br />
  21. 21. BitmapCachevs no Caching<br />
  22. 22. Image Do’s and Don’t‘s<br />Fast (with BitmapCache):<br />Transforms: Scale, Rotate, Translate<br />Opacitiy change<br />Clipping region change<br />Slow<br />Changing image with / height<br />OpacityMask<br />Non-rectangular clipping areas<br />Jpegs are (somewhat) faster than pngs<br />
  23. 23. Computing Intensive Applications<br />
  24. 24. Avoid Overloading the UI Thread<br />Use BackgroundWorker<br />Throttle calls to UI while it’s busyvia the “render loop”:<br />E.g a chart is redrawn whenever the Zoom changes<br />A chart redraw takes 100ms<br />The Zoom is changed at 0ms, 40ms, 80ms, 120ms<br />The chart will still be drawing at 40ms & 80ms!<br />
  25. 25. Rendering Real-Time<br />Lightweight vs heavyweight elements<br />Shapes vs Controls vsUserControls<br />Drawing is more expensive than redrawing<br />Reuse existing elements<br />WriteableBitmap & WriteableBitmapEx<br />Working with large Paths: buggy, slow<br />
  26. 26. Extreme Optimalizations<br />Data Binding<br />Avoid when there are thousands of objects<br />Takes up memory & notifications may fire too often<br />DPs<br />Only use if needed<br />Slow to read  cache in CLR properties<br />
  27. 27. Summary<br />Networking & effect on UI thread<br />Serialization & deserialization<br />ListBox<br />BitmapCaching<br />
  28. 28. Closing Thoughts<br />Use the performance counters<br />Performance can be optimized<br />(or you can always cut features…)<br />Test, test, test - on a device!<br />MIX 2011 – performance tool?<br />

×