advanced windows presentation foundation application performance tuning and analysis
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 PresentationTRANSCRIPT
![Page 1: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/1.jpg)
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
![Page 2: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/2.jpg)
> 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
![Page 3: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/3.jpg)
> 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
![Page 4: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/4.jpg)
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
![Page 5: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/5.jpg)
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”
![Page 6: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/6.jpg)
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
![Page 7: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/7.jpg)
Fishbowl
Bart J.F. De SmetCasual Application Developer (CAD)Windows Presentation Foundation
demo
![Page 8: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/8.jpg)
Taming Memory Usage
Eric HardingPerformance Guru (PG)Windows Presentation Foundation
demo
![Page 9: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/9.jpg)
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
![Page 10: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/10.jpg)
Cold Start
Eric HardingPerformance Guru (PG)Windows Presentation Foundation
demo
![Page 11: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/11.jpg)
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
![Page 12: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/12.jpg)
Warm Start
Eric HardingPerformance Guru (PG)Windows Presentation Foundation
demo
![Page 13: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/13.jpg)
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
![Page 14: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/14.jpg)
Runtime
Eric HardingPerformance Guru (PG)Windows Presentation Foundation
demo
![Page 15: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/15.jpg)
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
![Page 16: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/16.jpg)
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
![Page 17: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/17.jpg)
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
![Page 18: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/18.jpg)
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
![Page 19: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/19.jpg)
Stay in Touch
> Come and see us @ Ask The Experts
> Mail us
Q & A
![Page 20: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/20.jpg)
YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation
forms online atMicrosoftPDC.com
![Page 21: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/21.jpg)
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….
![Page 22: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/22.jpg)
© 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.
![Page 23: Advanced Windows Presentation Foundation Application Performance Tuning and Analysis](https://reader036.vdocuments.us/reader036/viewer/2022062520/568164e6550346895dd74f3f/html5/thumbnails/23.jpg)