Click here to Skip to main content
15,879,095 members
Articles / Web Development / ASP.NET
Article

The Simplest Way to Enhance Your Code’s Performance

3 Dec 2010CPOL3 min read 25.5K   12   2
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.

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.

image001.jpg

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.

image002.jpg

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.

image003.jpg

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.

image004.jpg

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.

image005.jpg

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.

image006.jpg

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.

image007.jpg

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.

image008.jpg

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.

License

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



Comments and Discussions

 
GeneralProblem using a trial version Pin
nainakarri23-Feb-11 18:50
nainakarri23-Feb-11 18:50 
GeneralI've used this -- it's great. Pin
dwilliss14-Dec-10 18:24
dwilliss14-Dec-10 18:24 

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.