DEV394 Windows Forms Performance Tips And Tricks Mike Henderlight Development Manager.NET Client Team Microsoft Corporation

Slides:



Advertisements
Similar presentations
SSRS 2008 Architecture Improvements Scale-out SSRS 2008 Report Engine Scalability Improvements.
Advertisements

DEV300: A Tiny CPU and OS in C# Scott Hanselman Technology Evangelist/Architect Corillian Corporation
Button b1 = new Button(); b1.Content = "OK"; b1.Background = new SolidColorBrush(Colors.LightBlue); b1.Width = 100; OK LightBlue Dim b1 As New Button.
DEV351 ADO.NET Performance Pablo Castro Program Manager – ADO.NET Team Microsoft Corporation.
Rob Tiffany Mobility Architect Microsoft Corporation WMB306.
DEV392: Extending SharePoint Products And Technologies Through Web Parts And ASP.NET Clint Covington, Program Manager Data And Developer Services - Office.
Windows Forms in Visual Studio 2005: An in-depth look at key features Name: Mike Henderlight Title: Program Manager.
Microsoft Office Project 2003 Resource Kits James Scott & Roy Riley Technical Content Development Microsoft Corporation.
Douglas Boling President Boling Consulting Inc. WEM201.
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
Anantha Kancherla Group Program Manager Microsoft Corporation PC04.
UI Design Patterns & Best Practices Mike Wolfson July 22, 2010.
DEV334 Creating Application Starting Points & Sharing Best Practices with Enterprise Templates Marc Gusmano Director of Emerging Technologies The Information.
EBZ318 Deploying A Content Management Server 2002 Solution Case Study Daniel Kogan Program Manager Microsoft CMS / E-Biz server Group.
OFC 200 Microsoft Solution Accelerator for Intranets Scott Fynn Microsoft Consulting Services National Practices.
MBL393 Location Aware Devices Chung Webster Application Development Consultant.
DEV290 Building Office Solutions with Visual Studio Eric Carter Lead Developer Developer Platform & Evangelism Microsoft Corporation.
DEP351 Windows ® Rights Management (Part 2): Enterprise Readiness & Deployment Marco DeMello Group Program Manager Windows Trusted Platforms & Infrastructure.
DEV397 Windows Forms Databinding Mike Henderlight Program Manager Windows Forms Microsoft Corporation.
DAT305 Boost Your Data-Driven Application Development Using SQL Server Centric.NET Code Generator Pascal Belaud Microsoft France.
DEV325 Deploying Visual Studio.NET Applications Billy Hollis Author / Consultant.
DEV339 Best Practices for Debugging Visual Studio.NET Applications Keith Pleas Architect, Guided Design
.NET Compact Framework Performance Strategies MBL 402 Ivo Salmre Product Manager.NET Developer Technologies, UK Microsoft Corporation.
OFC 307 Office 2003 Solution Case Studies Ray Stephenson Smart Client Technical Evangelist
1 Scheduling The part of the OS that makes the choice of which process to run next is called the scheduler and the algorithm it uses is called the scheduling.
Hosting an Enterprise Financial Forecasting Application with Terminal Server Published: June 2003.
DEV384 COM+ Lives : New Features in Enterprise Services Included in Windows Server 2003 Catherine Heller Senior Consultant Microsoft Spain.
DEV333 Instrumenting Applications for Manageability with the Enterprise Instrumentation Framework David Keogh Program Manager Visual Studio Enterprise.
Rob Tiffany Mobility Architect Microsoft Corporation MOB401.
EBZ 321 Extending CMS 2002 Publishing Processes Scott Fynn Microsoft Consulting Services National Practices.
MBL401.Net Compact Framework: Data Access Best Practices Paul Foster Mobile solutions architect.
DEV303 ASP.NET: Leveraging Visual Studio.NET For Web Projects Tony Goodhew Product Manager Microsoft Corp.
DAT 332 SQL Server 2000 Data Transformation Services (DTS) Best Practices Euan Garden Product Unit Manager SQL Server Development Microsoft Corporation.
DEV330 Visual Studio.NET IDE Tips and Tricks Billy Hollis Author / consultant.
DEP331 Migrating to Windows XP Mike Coleman Lead Product Manager, Windows XP Microsoft Corporation.
Introduction to z/OS Basics © 2006 IBM Corporation Chapter 7: Batch processing and the Job Entry Subsystem (JES) Batch processing and JES.
EBIZ327 InfoPath and BizTalk Server 2004 Scott Woodgate Jupiter Product Planner.
DEV396 Windows Forms: No Touch Deployment Tips and Tricks Jamie Cool Program Manager.NET Client Microsoft Corporation.
DAT325 SQL Server 2005 (Codenamed “Yukon”): Using the Service Broker To Build Asynchronous, Queued Database Applications Roger Wolter Program Manager.
DAT300 SQL Server Notification Services: Application Development Ken Henderson Technical Lead, SQL Server Support Microsoft Corporation
DEV393.NET Windows Forms Tips and Tricks Ken Getz Senior Consultant MCW Technologies, LLC.
DEV395 No Touch Deployment for Windows Forms Jamie Cool Program Manager.NET Client Microsoft Corporation.
Tips & Tricks: Writing Performant Managed Code Rico Mariani FUNL04 Performance Architect Microsoft Corporation.
DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant.
EBZ306 Advanced Business Process Automation Using BizTalk Server 2004 David Fong Program Manager.
DEV414 Black-belt ASP.NET Tips And Tricks For Your ASP.NET Applications Rob Howard Program Manager Web Platform and Tools Team.
OFC311 Developing Microsoft Office InfoPath 2003 Solutions: Technical Drilldown Part 1 Tudor Toma Group Program Manager Office Microsoft Corporation.
EBIZ312 Connecting Host Systems to Microsoft Technologies Paul Larsen Aaron Grady Microsoft Corporation.
5/2/2018 1:53 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS.
Easily manage SQL everywhere from anywhere with SQL Tools
TechEd /26/2018 3:42 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Build /24/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Windows Phone Platform Integration Yochay Kiriaty
Myth Busting: Hosted Web Apps
Microsoft Build /8/2018 3:30 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY,
TechEd /14/2018 6:26 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
A/B Testing for UWP Apps: Experiment for Success
Windows Phone: Optimizing Application Performance
F# for Parallel and Asynchronous Programming
TechEd /9/2018 4:17 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Quality & Performance for XAML Apps
Customizing WPA Trace Views
Windows Phone application performance and optimization
What’s new for Silverlight & XNA developers in Windows Phone Mango
ASP.NET 4 Core Runtime for Web Developers
Tech·Ed North America /17/2019 1:47 AM
DEV354 Visual Studio 2005: New Enhancements For Debugging Applications
TechEd /4/2019 3:19 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Windows Forms in Visual Studio 2005: An in-depth look at key features
Yale Digital Conference 2019
Presentation transcript:

DEV394 Windows Forms Performance Tips And Tricks Mike Henderlight Development Manager.NET Client Team Microsoft Corporation

Introduction Status of Windows Forms Performance Perceived vs. Actual Performance Areas of Focus Program Flow Drawing Startup Time Working Set Shutdown Wrap up

Status of Performance Runtime performance is very good Working set can be misleading CLR is sensitive to “memory pressure” Will allocate resources optimistically “Cold” application startup disk bound Many stress, leak, other issues fixed in v1.1 Only tactical performance work in v1.1, however

Basic Performance Techniques Don’t do work until you have to Remember, it’s “pay for play” Cache only when necessary – but it can be a powerful tool Don’t use exceptions in normal code flow Be aware of memory allocation – it’s very expensive

Windows Forms Performance Functions Methods for Batching Operations: BeginUpdate/EndUpdate BeginEdit/EndEdit Use Application.Idle to simulate asynchronous operations Beware of handle creations Always call Dispose when you can! Be careful with threads

Batching operations demo demo

Drawing Performance GDI+ designed for locale/device independent text rendering Lacks hardware acceleration Careful coding can result in good performance however Windows Forms has built in double buffering for Controls Image drawing trick of specifying a “premultiplied” format helps immensely. Important to use traditional drawing optimizing techniques of clipping, etc.

Optimizing Drawing in Windows Forms Applications demo demo

Optimizing Startup Time Startup time is the main area.NET needs to improve performance Primarily a Client issue – server applications are less concerned with this Faster hard drives make a big difference Can be mitigated by decreasing dependencies at startup

Techniques for Improving Startup “NGen” your assembly Do work on demand after the application is up and running Avoid loading extra assemblies and functionality Use progress UI or splash screens Remove any tracing switches or calls to config

Improving Startup Time and Perception – a walkthrough of optimizing an application demo demo

Do I Look Fat in This Runtime? What is Memory Pressure? Using available memory helps performance Minimizing, restoring app shows current “active” working set Not freeing references/disposing objects will hurt working set – can leak memory Remember event handlers hold references Applications generally shouldn’t be calling GC.Collect Always call Dispose when possible

Working Set and Memory Pressure demo demo

General Programming Tips Avoid using exceptions – they are very performance intensive Be very careful of overusing threads Use a StringBuilder for multiple concatenations If writing in C#, use unsafe code for manipulating native memory: private unsafe void WmWindowPosChanging(ref Message m) { WINDOWPOS* wp = (WINDOWPOS *)m.LParam; if ((wp->flags & WP_NOSIZE)) == 0) wp->cy += 100; }

More Tips… for is faster than foreach in critical codepaths Predefine Hashtable and Array sizes Be aware of initializing static and class initializers at class construction time Beware of operations that cause premature Handle creation or recreation Don’t create applications with thousands of controls. Windows has a limit of 10,000 per process, and much lower on Win9x. Consider owner-drawing your control or application.

Community Resources Most Valuable Professional (MVP) Newsgroups Converse online with Microsoft Newsgroups, including Worldwide User Groups Meet and learn with your peers

evaluations evaluations

© 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.