BT

Your opinion matters! Please fill in the InfoQ Survey!

Performance Tips For Metro Style XAML Apps

| by Roopesh Shenoy Follow 0 Followers on May 30, 2012. Estimated reading time: 1 minute |

A note to our readers: As per your request we have developed a set of features that allow you to reduce the noise, while not losing sight of anything that is important. Get email and web notifications by choosing the topics you are interested in.

Microsoft has published a paper named “Performance Tips For Metro Style XAML Apps”. This includes several suggestions for remaining responsive, ensuring fluid animations, improving startup time, consuming lesser resources and more. We present a summary here.

UI related -

Animations -

  • Let Animations be independent (of the UI thread) wherever possible
  • Minimize overdraw – for e.g. by collapsing completely obscured elements, using composite elements instead of layering objects
  • Use ‘CacheMode’ for caching a canvas if the elements don’t change/animate
  • Avoid Animating Web View

Startup times -

  • Improve perception by using Splash Screens, Loading pages, background loading of data
  • Minimize XAML to be parsed at startup
  • Optimize Element Count
  • If it does not make much difference, combine assemblies – loading one large assembly typically takes lesser time than loading two small ones

App Process Lifetime -

  • Suspend before termination – an app has upto 5 seconds to save it’s data on suspending before it is terminated.
  • Serialize and de-serialize only data that has changed
  • Free as much memory as possible on suspension and release handles to files and devices. However also design to resume quickly
  • Reuse brushes between pages by creating them as ResourceDictionary elements – this can improve caching

Displaying Data -

  • Use UI virtualization i.e. create only those objects that are near to the view port, and Data virtualization i.e. read large data sets in small increments as and when needed
  • Use Item template selectors

Media -

  • Use full screen playback when possible
  • Don’t overlay embedded video
  • Delay setting the source of the MediaElement
  • Match Video/Image resolution with device resolution if possible
  • For Windows 8, Microsoft recommends H.264 video as the primary video format and AAC and MP3 as the preferred audio formats. Use WAV when including short audio effects (such as in games)

The paper by Microsoft contains detailed explanation with code samples. There is a separate article on DirectX and XAML interop which is not covered in this paper. 

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT