Upload
imala
View
48
Download
0
Tags:
Embed Size (px)
DESCRIPTION
CL11. Advanced Windows Presentation Foundation Application Performance Tuning and Analysis. Bart J.F. De Smet and Eric Harding Software Development Engineers Microsoft Corporation { bartde,erichar }@microsoft.com blogs.bartdesmet.net/ bart. - PowerPoint PPT Presentation
Citation preview
Advanced Windows Presentation Foundation Application Performance Tuning and AnalysisBart J.F. De Smet and Eric HardingSoftware Development EngineersMicrosoft Corporation
{bartde,erichar}@microsoft.comblogs.bartdesmet.net/bart
CL11
> Unified presentation model for Windows applications, web applications, graphics/media/animation
> Integrated, vector-based compositing engine> Native support for advanced input> Support for declarative programming
> Markup for Windows> Build applications in simple declarative statements> Easy to learn, write, and read
> Code and content are separate> Streamline collaboration between designers and
developers > Easy for tools to consume and generate
Button b1 = new Button();b1.Content = "OK";b1.Background = new SolidColorBrush(Colors.LightBlue);b1.Width = 100;
<Button Width="100px"> OK <Button.Background> LightBlue </Button.Background></Button>
Dim b1 As New Buttonb1.Content = "OK"b1.Background = New SolidColorBrush(Colors.LightBlue)b1.Width = 100
WPF = Designer + Developer> Resource constraints> Drowning in effects> Excessive use of
images> “Rich” templates
> Loaded modules> Startup time> Memory leaks> Large element count
Composition = Power
Performance General TruthMeasure, measure, measure• Identify key scenarios and set clear goals• Start measuring early on representative hardware
Low hanging fruit• Let measurements be your guide• “Premature optimization is the root of all evil”
Perceived performance• Make it feel fast• “An art, not a science”
Trade-offs• CPU versus memory, etc• “To ship is to choose”
Fishb wlA sample by uxlabs@Microsoft> Dive into Facebook!
Fishbowl bringsFacebook to your desktop.> Stay Connected> View and Share Photos> Explore and Organize> Ready for Windows 7
> WPF 3.5 SP1 Application> www.fishbowlclient.com> www.codeplex.com/fishbowl
Fishbowl
Bart J.F. De SmetCasual Application Developer (CAD)Windows Presentation Foundation
demo
Taming Memory Usage
Eric HardingPerformance Guru (PG)Windows Presentation Foundation
demo
Performance Checklist
> Image size> Size in memory!
> Managed leaks> Allocation stack> (GC) root path
> Element count> Virtualization
Cold start
Warm start
Runtime
Memory
• Image size• Memory leaks• Element count
Cold Start
Eric HardingPerformance Guru (PG)Windows Presentation Foundation
demo
Performance Checklist
> All about disk I/O> Modules
> Need dependencies?
> Loaded at JIT time> Beware of inlining
> NGen> I/O versus CPU (JIT)> Better for warm
start
Cold start
Warm start
Runtime
Memory
• Disk I/O• Module loads• NGen
Warm Start
Eric HardingPerformance Guru (PG)Windows Presentation Foundation
demo
Performance Checklist
> All about CPU time> Avoid blocking
> Delay work if possible> Incremental loading
> Perception = key> Splash screen> Transition effects
Cold start
Warm start
Runtime
Memory
• Avoid blocking• Delay work• Perceived perf
Runtime
Eric HardingPerformance Guru (PG)Windows Presentation Foundation
demo
Performance Checklist
> IRTs> Effects, clips, opacity,
opacity mask> Bitmap effects (v3.x)
> Element count> Input and routed events
> In .NET 4.0> Cache composition
Cold start
Warm start
Runtime
Memory
• Excessive *.*• Beware of IRTs• Eventing
Runtime Best Practices> Don’t block the UI thread> Virtualize when needed
> UI virtualization> Data virtualization
> Freeze your freezables!> No change notification callbacks
> Hardware versus software> RDP, virtual machines, old hardware> RenderCapability.Tier> Reduce frame rate, animations, 3D
Lessons Learned• Excessive *.*• Beware of IRTs• Eventing
• Avoid blocking• Delay work• Perceived perf
• Disk I/O• Module loads• NGen
• Image size• Memory leaks• Element count
Composition + Measurement = PowerMemory Cold start Warm start Runtime
Resources> Windows SDK Perf Tools
> bing.com/search?q=windows+sdk> SysInternals tools
> www.sysinternals.com> SciTech .NET Memory Profiler
> www.memprofiler.com> WPF performance @ MSDN
> bing.com/search?q=wpf+performance+msdn> Performance Blogs
> WPF – blogs.msdn.com/jgoldb> .NET – blogs.msdn.com/ricom
Stay in Touch
> Come and see us @ Ask The Experts
> Mail us
Q & A
YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation
forms online atMicrosoftPDC.com
Learn More On Channel 9> Expand your PDC experience through
Channel 9.
> Explore videos, hands-on labs, sample code and demos through the new Channel 9 training courses.
channel9.msdn.com/learnBuilt by Developers for Developers….
© 2009 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.