This is a showcase review for our sponsors at CodeProject. These reviews are intended to provide you with information on products and services that we consider useful and of value to developers.
If you are involved in .NET development, you have probably become familiar with the situation of having code that sort-of-works, but is quite a long way from the ideal solution. .NET applications often run very slowly or hog system resources, even when they’ve been coded “from the book,” often because more is going on behind the scenes in the .NET library than you might think.
ANTS Profiler is a code profiling tool designed for .NET developers who want to get to the bottom of these and other related issues. Technical testers also use ANTS Profiler to pin bugs down to a specific line of code or to determine scope for optimization.
What ANTS Profiler does
ANTS Profiler allows you to identify slow lines of code in .NET applications within 5 minutes of installation, allowing you to get on with what you do best – writing code. The program can also be used to measure line-level timings and method execution times, and to understand how your application performs.
Profiling an application with ANTS Profiler
ANTS Profiler will profile Windows applications, ASP.NET web applications, COM+ applications and .NET web services. It supports applications written in VB.NET, C#, C++ (managed) and any other language supported by the .NET framework (this includes over 40 languages).
It is the ideal tool when you’ve developed an application and you need to see if it is going to perform as expected.
The screenshots and explanation below are from ANTS Profiler’s demo application. Please follow along with this brief introduction to the tool.
This is the main screen of ANTS Profiler. As a first-time user you will need to "Set up a new project for profiling a .NET application."
Setting up a new project
To start profiling your application, you need to tell ANTS Profiler what sort of application it is that you are running and any other details that might be important.
Once you've selected your program, you can begin profiling by clicking "OK". In the example here we’ve chosen "mandlebrot.exe", which is the demo application provided by Red Gate.
When you press OK, the application is run and the Profiler measures the lines of code being executed.
Starting and stopping ANTS Profiler
This "control" window will pop up and whichever button is shaded will tell you whether or not you are profiling (as decided in your profiler configuration). You may decide to wait before you start profiling, in which case you will need to press the "GO!" button to begin.
Profiling involves you using your application to do the things that you are interested in, while ANTS Profiler is running. ANTS Profiler will gather lots of information about what is happening in your code. Occasionally this can cause your application to slow down - this will have no influence on the accuracy of the results since ANTS Profiler has sophisticated algorithms to take this into account.
Once you've finished, click the "STOP!" button, and the results will be displayed automatically.
Profiling Results
Top 100 Slowest Functions
The first set of results displayed are shown in order of their "Procedure time". Procedure time is defined as the time spent in a function,not including sub functions. These results are the most important ones and are, therefore, the statistic of most interest in finding out where your application is spending its time.
"Total" is the amount of time spent in that function, including time in sub functions.
"Hits" are the number of times a function has been called. The other figures are used mainly for checking data validity and in web applications. The results can be sorted according to any of these.
In this case, we might decide to look into more details about what is happening in the 9th function from the top. If we click on this function, ANTS Profiler will provide more details.
Details of a Function
This shows the exact lines of code that are taking a long time to execute, which provides a good starting point to improving the code. Although this line of code doesn't take very long to execute, the extreme number of times it is called seems to be causing problems in slowing down the application.
A vital development tool
ANTS Profiler is a simple .NET code profiler that gives you the information you need simply and rapidly. Appropriate pieces of code can then be optimized, so performance is improved, and hardware requirements are lowered. It is simple to use, and the results produced make it easy for any .NET developer to understand where bottlenecks or problems in code lie.
There are a number of positive reviews of ANTS Profiler, which has been described as "an excellent tool that allows you to really pinpoint those portions of your code that cause the most hassle for your end users."
Evaluate ANTS Profiler with your applications to see how well it will work for you - download a free, fully functional, 14-day trial.