Click here to Skip to main content
12,999,837 members (49,861 online)
Click here to Skip to main content
Add your own
alternative version


12 bookmarked
Posted 3 Dec 2010

The Simplest Way to Enhance Your Code’s Performance

, 3 Dec 2010
Understanding why an application performs poorly can be a tedious process, with the causes of performance problems almost never found in the expected place. ANTS Performance Profiler quickly obtains high accuracy results, letting you achieve hours or days of problem hunting in minutes.

Editorial Note

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

Getting Started

Upon starting ANTS Performance Profiler we are presented with a choice of application type to profile.


Figure 1: Selecting an application

ANTS Performance Profiler can be used to analyze the performance of desktop applications, Silverlight 4, ASP.NET, Windows Services, COM+ Server, SharePoint, WPF, and XBAP files, and works with all languages supported by the .NET Framework.

After choosing the application, you’re ready to go. ANTS Performance Profiler automatically loads the program and begins profiling. It can also attach to any running .NET 4 process without having to restart that application – great if there’s an intermittent performance problem which is hard to reproduce, or if you need to analyze a live service like an ASP.NET website without having to stop and restart it.

Working with the Profiler

While your application is running, a timeline is continually updated showing the monitored performance metrics.


Figure 2: The graphical timeline

You can interact with the timeline, even while ANTS Performance Profiler is still profiling. By selecting any region, only data from that time-period is analyzed, preventing you from being swamped with information. So for example, the red line in the image below represents the CPU usage, and the peak region can be selected for more detailed analysis. You can even name the selected region to return to it later.


Figure 3: Selecting and naming a region

Understanding the Performance Issue

Once a region of the timeline has been selected, ANTS Performance Profiler automatically expands the most expensive stack traces so you can see the methods with the highest time with children or greatest hit count. From here you can drill down to the most likely cause of code bottlenecks.


Figure 4: The call tree view showing the hottest path

Alternatively, the methods grid presents a searchable list of all methods which were called within the given time period, and can be sorted by time with children, hit count, or by name.


Figure 5: The methods grid view

Selecting any of these methods jumps straight to the source code view, where line level timings allow easy identification of slow lines of code. A clickable heat map highlights these to making navigation simple.


Figure 6: Line level timings in the source code view

For any of the methods for which code is available, ANTS Performance Profiler can generate a call graph to visualize the callers for a selected method. These expandable graphs can be exported to enable simplified documentation and sharing as part of a development team.


Figure 7: The call graph view

Profiling SQL and File I/O Activity

When trying to understand an application’s performance, it is important to have as much information as possible. ANTS Performance Profiler is the only code profiler to also profile SQL and File I/O performance, giving a much more complete picture on why code might not be performing as expected.

SQL activity is displayed on the interactive timeline, just like performance metrics. For any selected region, a list of run queries is presented. More importantly, by allowing you to see the complete stack trace at the precise time of a misbehaving database request, it is possible to understand the interaction between your .NET code and SQL Server in a way which isn’t possible using SQL Server Management Studio.


Figure 8: Profiling SQL activity

What’s Next?

Once you’ve finished profiling you can save your entire session, enabling you to share results with you team, present data in meetings, or simply return to your work later.

ANTS Performance Profiler is the simplest, most effective way to find and resolve performance issues in .NET code. To see how much faster your application could run, download a free 14-day trial of ANTS Performance Profiler today.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

You may also be interested in...


Comments and Discussions

GeneralProblem using a trial version Pin
nainakarri23-Feb-11 18:50
membernainakarri23-Feb-11 18:50 
GeneralI've used this -- it's great. Pin
dwilliss14-Dec-10 18:24
memberdwilliss14-Dec-10 18:24 
I just used ANTS Profiler last week at work. I had a memory leak in a new program I was writing and the ANTS memory profiler helped me find a class that wasn't being Dispose()'d of so it was holding on to a DataSet.

The code profiler helped me find a major bottleneck too.

I was glad to have found both of those before going to production.

If I had one wish, it would be for the profiler to let you pick any Performance Counter to add to the graph. It gives you a list of several to choose from, but I put a throughput performance counter in my code so I can monitor it with the Windows Performance Monitor. It would be nice to be able to capture that along with the other profiling data. Then I could go back and see where the throughput counter is low and check what's going on at that time.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170624.1 | Last Updated 3 Dec 2010
Article Copyright 2010 by Red Gate
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid