The guys across the hall from us just released ANTS Performance Profiler 7.3, and there are some awesome features for anyone who works with ASP.NET. The profiler now displays .NET code performance alongside database calls, and that insight is all contextualised according to HTTP requests, so you can attribute specific behaviour in your application to the code on the screen. The ability to quickly track down performance bottlenecks, whether they’re in .NET code or database queries, is a great example of the next generation of performance profiling.
But what I’d like to mention is that they’ve also integrated .NET Reflector directly into the profiler, so you can now track down performance issues that are inside 3rd party code.
If you’ve not seen it before, ANTS Performance Profiler is a code profiling tool for finding performance issues in .NET applications. The tool now uses the .NET Reflector decompilation engine let you profile 3rd party code or legacy applications, and you don’t have to leave the profiler to do it.
I think a quick walkthrough is in order…
Profiling Assemblies without Source
When you’re profiling methods and assemblies, but don’t have access to the source code, you can generate the source directly from the profiler interface. Begin profiling, and select an area on the timeline that you want to investigate. In the Call Tree View, select the method that you suspect harbours the performance issue, and click the Decompile button in the Source Code View at the bottom of the UI:
.NET Reflector (technically, the decompilation engine from .NET Reflector 7.3) steps in at this point and generates source code for the method. You can then browse and navigate the generated code as if it were your own (you can see in the screenshot below how the first line of the “new” method body is highlighted):
If you have the assembly’s .PDB file, you can even view line-level timings for the decompiled code, letting you identify the exact line that caused the bottleneck. If you don’t have a .PDB file, take .NET Reflector 7.5 for a spin, and you’ll be able to generate this inside Visual Studio. The heat map alongside the vertical scroll bar also helps you jump directly to the lines of code that account for the greatest execution time, so finding performance problems should be a synch:
With a little help from .NET Reflector, even if the performance problems in your applications lie legacy code or someone elses’ DLLs, you can use ANTS Performance Profiler to pin down the bottleneck.
To learn more, simply visit the Red Gate website and help yourself to a free 14-day free trial of ANTS Performance Profiler.