230 likes | 421 Views
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.
E N D
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
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
<Button Width="100px"> OK <Button.Background> LightBlue </Button.Background> </Button> Button b1 = new Button(); b1.Content = "OK"; b1.Background = new SolidColorBrush(Colors.LightBlue); b1.Width = 100; Dim b1 As New Button b1.Content = "OK" b1.Background = New SolidColorBrush(Colors.LightBlue) b1.Width = 100 • 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
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
FishbwlA 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 demo Bart J.F. De Smet Casual Application Developer (CAD) Windows Presentation Foundation
Taming Memory Usage demo Eric Harding Performance Guru (PG) Windows Presentation Foundation
Performance Checklist • Image size • Memory leaks • Element count Memory • Image size • Size in memory! • Managed leaks • Allocation stack • (GC) root path • Element count • Virtualization Cold start Warm start Runtime
Cold Start demo Eric Harding Performance Guru (PG) Windows Presentation Foundation
Performance Checklist • Disk I/O • Module loads • NGen Memory • 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
Warm Start demo Eric Harding Performance Guru (PG) Windows Presentation Foundation
Performance Checklist • Avoid blocking • Delay work • Perceived perf Memory • All about CPU time • Avoid blocking • Delay work if possible • Incremental loading • Perception = key • Splash screen • Transition effects Cold start Warm start Runtime
Runtime demo Eric Harding Performance Guru (PG) Windows Presentation Foundation
Performance Checklist • Excessive *.* • Beware of IRTs • Eventing Memory • 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
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 • Image size • Memory leaks • Element count Cold start Warm start Runtime Memory • Avoid blocking • Delay work • Perceived perf • Excessive *.* • Beware of IRTs • Eventing • Disk I/O • Module loads • NGen Composition + Measurement = Power
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 Q & A Come and see us @ Ask The Experts Mail us
YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation forms online at MicrosoftPDC.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/learn Built by Developers for Developers….