Comparing performance between two method implementations in .NET
I want to make a change to the way that a particular method in my code has been implemented. Before committing that change to production, I'd like to make sure that my changes have no or minimal impact on the performance of that particular method. Are t开发者_如何转开发here any tools available that will allow me to easily performance test individual method implementations in .NET? How else would I be able to achieve this kind of granular performance testing?
You can use the Visual Studio Profiler (Premium and Ultimate Editions):
Beginners Guide to Performance Profiling (Visual Studio)
Find Application Bottlenecks with Visual Studio Profiler
Analyzing Application Performance by Using Profiling Tools
How to: Compare Profiler Data Files (You can compare the results of two different profiler data files (.vsp or .vsps) by creating a comparison ("Diff") report or view. The comparison shows the differences, performance regressions, and improvements that occurred from one profiling session to the other.)
Visual Studio Profiler Team Blog
There are also commercial tools from RedGate and JetBrains
Also Eqatec (which is free)
Use a profiler - there is one built into Visual Studio.
You can also get commercial ones - DotTrace and Ants Performance Profiler have good reputation.
You need to measure before the changes to get a baseline, then after to see what effect your changed have had.
精彩评论