1 / 14

Optimizing Performance Using Code Profilers

Optimizing Performance Using Code Profilers. Phil Wolfe, MCSD, MCAD, MCDBA RAD .NET Architect Werner Enterprises. Agenda. Overview Why Profile Code Code Profilers Where to Profile How to Profile Windows Example Conclusion Resources. Overview. Profilers measure performance

jaden
Download Presentation

Optimizing Performance Using Code Profilers

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Optimizing Performance Using Code Profilers Phil Wolfe, MCSD, MCAD, MCDBA RAD .NET Architect Werner Enterprises

  2. Agenda • Overview • Why Profile Code • Code Profilers • Where to Profile • How to Profile • Windows Example • Conclusion • Resources

  3. Overview • Profilers measure performance • Not a test suite • Compare to sphygnometer not stethoscope • Types of profilers: • Code – Watching lines of code • Memory – Watching memory use and management • Hardware – Comparing output to standard

  4. Why Profile Code • Developers don’t always write code in the most efficient way. • 4GL code doesn’t always translate down in the most efficient or expected way. • Frameworks are built to support many solutions not optimized for any specific one. • Like tuning a musical instrument.

  5. Code Profilers • Measure code performance by: • Counts (Hit Count) • Source Code Lines • Methods • Modules • Time • First hit vs. subsequent hits • Per method/parent/child(ren) in milli/micro-seconds • Time in application vs. time in .NET Framework

  6. Short List of Code Profilers • ANTS 1.3 – www.red-gate.com • AQTime 4 – www.automatedqa.com • DevPartner Profiler Community Edition – www.compuware.com • NCover – ncover.sourceforge.net • NProf – nprof.sourceforge.net

  7. Phil’s Profiler Picks • AQTime 4 – AutomatedQA Corp. • Price: $599.99 • Profiles: Windows, Web, Serviced Components, Services • Displays Source Code • Integrates with Visual Studio.NET or Standalone • Overall: best interface, easiest to use, most fully-featured, very customizable, and documented

  8. Phil’s Profiler Picks • ANTS Profiler – Red Gate Software • Price: $295 • Profiles: Windows, Web, & Serviced Component • Displays Source Code • Does not integrate with Visual Studio.NET • Can not profile Windows Service applications

  9. Phil’s Profiler Picks • DevPartner Community - Compuware • Price: Free (Pro Ed. $1,700.00) • Profile: Windows, Web (Serviced Component & Windows Services with Pro Ed.) • Displays Source Code • Integrates with VS.NET • Needs Framework 1.0 to install (see resources)

  10. Where to Profile • Slow Calls • “Main” Logic • “Messy” Logic • Everything • New Operating Systems • New .NET Framework Versions

  11. How to Profile • Compile in debug • Use the profiler to launch the application • Get a baseline • Start changing code • Start experimenting with other settings • Read the tutorials • Keep in mind while profiling: • The code is compiled in debug • JIT happens the first method call • Other processes on the machine

  12. Windows Example • Maze application – Dan Fontanesi, Mike Gold, http://www.gamespp.com/csharp/mazeSolverUsingMultipleThreads.html • Get a Baseline • Make modifications • Test performance • Examine MSIL • Make more modifications • And on and on…

  13. Conclusion • Performance TUNE your applications by enhancing code • More hardware is not always the answer • Develop baselines and expectations • Perform code reviews in conjunction with code profilers • Choose the right profiler. A free one may cost more time in the end.

  14. Resources • See Profilers Slide • DevPartner installation workaround: To avoid installing the .NET Framework v1.0 on machines that do not have it installed, copy a v1.0 mscorlib.dll file to <root drive>\<windows folder>\Microsoft.NET\Framework\v1.0.3705\mscorlib.dll

More Related