Microsoft silverlight performance on windows phone
Download
1 / 44

- PowerPoint PPT Presentation


  • 254 Views
  • Updated On :

SESSION CODE: WPH309. Microsoft Silverlight Performance on Windows Phone. Yochay Kiriaty Senior Technical Evangelist Microsoft Corporation [email protected] ; twitter @ yochayk Windowsteamblog.com/ wpdev. Learning Windows Phone. http://learningwindowsphone.com /. Performance.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about '' - skip


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Microsoft silverlight performance on windows phone l.jpg

SESSION CODE: WPH309

Microsoft Silverlight Performance on Windows Phone

Yochay Kiriaty

Senior Technical Evangelist

Microsoft Corporation

[email protected] ; twitter @yochayk

Windowsteamblog.com/wpdev


Learning windows phone l.jpg
Learning Windows Phone

http://learningwindowsphone.com/




Sl performance on windows phone l.jpg
SL Performance on Windows Phone

  • Silverlight for Windows Phone

  • Understand the architecture and Concepts

  • Monitor

    • Performance Counters

    • Understand the tools

  • Plan Ahead

    • Less is more

    • Leverage Render thread

    • Leverage GPU

      • Caching

      • Imaging/Media


What is silverlight for windows phone l.jpg
What is Silverlight for Windows Phone?

Starts with Silverlight 3 plus…

  • Performance tuning

  • Input integration

  • H/W media and sensor integration

  • OS application model integration

  • Relaxed sandbox constraints




Silverlight threading on the phone l.jpg
Silverlight Threading (on the phone)

  • One UI thread

  • One Render Thread

  • Many worker threads

    • User threads

    • Media decoding threads


Silverlight threading on phone l.jpg
Silverlight Threading (on Phone)

UI thread

Render Thread

Simple Animations

Only “double” Animations for simple Properties

Render Transforms

Opacity

Perspective Transforms

Rectangular Clip

  • Input (touch)

  • Layout

    • Measure and arrange

  • User code

    • E.g. per-frame callbacks

    • E.g. Blocking on Network

  • Animations not done in Render thread


Silverlight threading on the phone11 l.jpg
Silverlight Threading (on the phone)

  • Show my Frame

UI Thread

Render Thread

  • Animate


Ui thread vs render thread l.jpg

UI Thread Vs. Render Thread

Render thread demos

Demo


Animation system l.jpg
Animation System

  • Frame-based Animation when CPU bound

  • Time-based Animation when CPU bound


Tools and counters l.jpg

Tools and Counters


The emulator l.jpg
The Emulator

  • Leverages GPU on your PC

  • Often much more CPU than on device

  • Uses a single core

  • Requires DirectX 10 capable hardware


Performance counters l.jpg
Performance Counters

Application.Current.Host.Settings.EnableFrameRateCounter = true;

Render Thread frame rate (fps)

UI Thread frame rate (fps)

Amount of VRAM used by App (kb)

Total # of Textures on GPU

# of Intermediates


Dirty regions l.jpg
Dirty Regions

Application.Current.Host.Settings.EnableRedrawRegions= true;

  • Visually indicates the elements thatare being redrawn with each frame (texture rasterized by the UI thread)



Cache visualizations l.jpg
Cache Visualizations

  • Application.Current.Host.Settings.EnableCacheVisualization = true;

  • Applies a color overlay to visuals that are not GPU accelerated



Practices to drive performance l.jpg
Practices to drive performance

1. Identify potential problem areas

Startup? Memory? Framerate?

2. Monitor as changes are made

Framerate, Size of Dirty Regions

3. Test on device, often.

4. Include designers early and often


Performance strategy l.jpg
Performance Strategy

  • Less is more

  • Minimize UI thread work

  • Leverage Off-thread

  • Leverage GPU

  • Rinse and Repeat (1-4)


Less is more l.jpg
Less is more

  • Slim Visual Trees

  • Virtualization

  • Collapse items that are not visible

    • Z order doesn’t count

  • Use redraw regions to measure impact to tree

    • Events

    • Layout

    • Rendering

  • Avoid Small property changes or use “render thread“ animation.


Leverage gpu render thread l.jpg
Leverage GPU & Render Thread

  • Use simple animations of Simple properties

  • Cache

  • Avoid large textures


Caching l.jpg
Caching

  • CacheMode = BitmapCachewill cache the rasterized (textures) version of a UIElement and its children

  • Tips:

    • Know your tree. Must have no SW-only features in self or parent.

  • Silverlight auto-caches animations when possible. Don’t count on it, verify it.



Slide27 l.jpg

Quiz

  • In the next demo, what allows the blue ellipse (including its opacity mask) to animate on the Render thread and not the UI thread? (with the same outcome)

Use BitmapCache on the ellipse to cache it once and then let the render thread have fun

1

Add the ellipse as child to a canvas that is animated and use BitmapCache

2

Remove the replace OpacityMask with Opacity

3

I have no idea

4


Caching bitmapcache l.jpg

Caching = BitmapCache

Demo


Media l.jpg
Media

  • Video ( MediaElement )

    • Rendered in Render thread

    • Must be cached. CacheMode required in earlier builds, not required later, but it is being applied.

    • Still, less is more:

      • Right size

      • Minimum frame rate possible.

  • Images

    • Decoded in software.


Start up l.jpg
Start-up

  • Use a splash screen

    • Include applicationsplashscreen.jpg

  • Delay loading resources at start-up.


Performance pitfalls l.jpg
Performance pitfalls

  • SW-only features:

    • Non-rectangular clips

    • Opacity mask – DO NOT use it!

    • Large textures ( > 2K pixels either way)

    • Not simple animations (e.g. ColorAnimation)


Conclusion l.jpg
Conclusion

  • Windows Phone comes optimized.

  • Your app should take advantage of the architecture and the hardware

  • Avoid SW rendering

  • Know your tree


Windows phone resources l.jpg
Windows Phone Resources

Questions? Demos? The Latest phones?

Visit the Windows Phone Technical Learning Center for demos and more…

  • Business IT Resources

    www.windowsphone.com/business

  • Developer Resources

    developer.windowsphone.com

  • Experience Windows Phone 7 on-line and get a backstage pass

    www.windowsphone7.com


Win a windows phone contest l.jpg
Win a Windows Phone Contest

Hat Contest*

How do you enter?

Enter by visiting the Windows Phone booth, accepting a free Windows Phone branded hat, and wearing that hat during the Event.

How am I selected?

Each day of the event, a Windows Phone representative will randomly select up to 5 people who are observed wearing their Windows Phone branded hat

Session Contest*

During each Windows Phone session the moderator will post a question. The first person to correctly answer the question and called on by the moderator will potentially win

Questions?

Go to the WPH Information Counter at the TLC

* Restrictions apply please see contest rules for eligibility and restrictions. Contest rules are displayed in the Technical Learning Center at the WPH info counter.


Related windows phone content breakout sessions mon tue l.jpg
Related Windows Phone Content – Breakout Sessions Mon &Tue

Monday

WPH301WP7: Deploy Microsoft Forefront Unified Access Gateway for Access Control to SharePoint, Exchange and more.

WPH202 Deploying Windows Phone 7 with Exchange Server and SharePoint Server

Tuesday

WPH203 Overview of the Windows Phone 7 Application Platform

WPH313 Windows Phone 7 Architecture Deep Dive

WPH304 An In-Depth view at Building Applications for WP7 with Silverlight (Part 1)

WPH305 An In-Depth view at Building Applications for WP7 with Silverlight (Part 2)

WPH306 Developing Occasionally Connected Applications for Windows Phone 7


Related windows phone content breakout sessions wed thu l.jpg
Related Windows Phone Content – Breakout Sessions Wed &Thu

Wednesday

WPH310 Designing and Developing for the Rich Mobile Web

WPH311 Developing Mobile Code Today that will run on WP 7 Tomorrow

WPH309 Silverlight performance on Windows Phone

WPH307 Building Windows Phone Games with XNA

WPH308 Building a High Performance 3D Game for Windows Phone

Thursday

WPH303 Understanding the Windows Phone 7 Development Tools

WPH314 Learn Windows Phone 7 Development by Creating a Robotic T-Shirt Cannon

WPH312 Understanding Marketplace and Making Money with WP7 Applications


Related windows phone content interactive session hol l.jpg
Related Windows Phone Content – Interactive Session & HOL

Windows Phone Interactive Sessions

Windows Phone 7 Demo Only!

Microsoft’s Next Generation Mobile Enterprise Application Platform (MEAP)

Windows Phone 7 Application Performance

Prepare for Windows Phone 7 Development! Coding practices you should start using now in Windows Mobile

Windows Phone Hands On Labs

Hello Windows Phone - Building Your first Windows Phone Application

Microsoft Silverlight for Windows Phone

Microsoft XNA Framework 4.0 for Windows Phones

Using Push Notifications and Windows Communication Foundation (WCF) Services


Resources l.jpg

Required Slide

Resources

Learning

  • Sessions On-Demand & Community

  • Microsoft Certification & Training Resources

www.microsoft.com/teched

www.microsoft.com/learning

  • Resources for IT Professionals

  • Resources for Developers

  • http://microsoft.com/technet

  • http://microsoft.com/msdn


Slide40 l.jpg

Required Slide

Complete an evaluation on CommNet and enter to win!


Slide41 l.jpg

Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31st

http://northamerica.msteched.com/registration

You can also register at the North America 2011 kiosk located at registrationJoin us in Atlanta next year


Slide42 l.jpg

© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.


Slide43 l.jpg

Quiz

  • In the next demo, what allows the blue ellipse (including its opacity mask) to animate on the Render thread and not the UI thread? (with the same outcome)

Use BitmapCache on the ellipse to cache it once and then let the render thread have fun

1

Add the ellipse as child to a convenes that is animated and use BitmapCache

2

Remove the replace OpacityMask with Opacity

3

I have no idea

4


ad