Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have an application that I am trying to squeeze every last drop of performance out of, So I am looking for a profiler that can give me some sort of info on where my bottlenecks are. I have seen a couple out there that give line by line speeds or method speeds (ANTS and the profiler with VS 2010 Premium), but since they are all pretty expensive, I would like to know which would be the most helpful for this sort of thing. Any recommendations?

share|improve this question
Reading the code and re-evaluating your algorithms probably most helpful. Profiling should be a last and final step. – sa93 Sep 2 '11 at 14:02
5  
@sa93 If you don't profile, how do you know which methods to optimize to create the biggest gains for the least effort? Or which algorithms are the most costly? Profiling should be the first step to identify parts of code to read and evaluate. – Thomas Owens Sep 2 '11 at 14:15
@sa93 - That has already been done to the point where any further optimizations will result in less maintainability/clarity. Performance happens to be a requirement on this project though, so I have to cut into those things. I am simply using the profiler as a tool to make the most efficient changes with the least impact to code quality. – Morgan Herlocker Sep 2 '11 at 14:18
Thomas, you dont need to profile to know which algorithms for example are expotentially different. If you cant identify an algo that is o(n) vs o(1) or o(log n) then you need to go back to the drawing board. On a more real level though a profile might say your stuck in ExecuteScalar and then you might optimize the query, or connection pooling when a more higher level approach would be to look if possible to avoid the query alltogether – sa93 Sep 2 '11 at 14:45
2  
Most of the big profilers (ANTS, dotTrace etc) all have trial periods, why not try them out and see which works best for you? I'm sure you could find proponents of all of them here, but it would be hard to say which one would actually work best for you. – Brook Sep 2 '11 at 15:36
show 8 more comments

closed as off topic by Robert Harvey, Anna Lear Sep 2 '11 at 19:49

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

4 Answers

We use Redgate Ants Profiler.

http://www.red-gate.com/products/dotnet-development/

Please note I do not work for Redgate, just saying what we use. It has helped us a few times identify poor performing code when a customer reports something is slow.

Our shop only bought one license because we don't use it every day, so we have one machine that can do the profiling as necessary. Probably helped us sort out 1/2 dozen to a dozen performance issues. In general it can also be used for refactoring, which we have done on a few occasions. We have found that several methods where redundant when profiling because of poor coding/design. Its not an everyday tool for us, but a valuable one.

share|improve this answer

I have had great success with Equatec's Profile: http://www.eqatec.com/Profiler/

It's free, but they also sell a lot of analyses tools which are very handy.

share|improve this answer
Could this be a dead link? – Morgan Herlocker Sep 2 '11 at 15:14
3  
Works fine for me. Google Chrome v13 – Malfist Sep 2 '11 at 15:18

dotTrace is another good option, and is a bit cheaper than some of the alternatives because it is newer.

share|improve this answer

What I recommend may be a bit of a mind-shift for you, but I and others rely on it.

The existing mindset says Measure.

So fine, you Measure.
Did it tell you what to fix?
If it tells you what not to fix, you can rely on that.
But how much help is that?

The different mindset does not say Measure - it says ask this question:

What the heck is it doing right now, and why is it doing it?

So, rather than getting a bunch of measurements, you wait until it's being slow, pause it, and thoroughly investigate what it was doing, and why, at the moment you paused it, just as if it were an actual bug.

You do this more than once - a small number of times. (That's critical.)
Anything you see it doing more than once, that it doesn't really need to do, is an opportunity for speedup.
Fix it, and enjoy the speedup, which is what it is, even though you didn't measure it (with any precision).

And here's the kicker:
There's no problem you can have that this won't find.

Rinse and repeat.
That's how to squeeze out every last drop of performance.

share|improve this answer
1  
I can pick up a lug wrench to rotate my tires, or I can use an air wrench, if I have one. Which is easier and does a better job? – Robert Harvey Sep 2 '11 at 19:47
@Robert: Bad analogy :) Let's see, what's a better analogy? Maybe a rowboat vs. Mercedes-Benz, when you need to cross water? Telling time with a clock with only a second hand? But let's get specific. Eqatec is a very nice profiler. We've got an app with 100k methods that takes about a minute to start up. The profiler says a bunch of methods take >50% inclusive time, including the one that gets a string from a resource. But it's not really telling me why. I pause it a few times in that minute. The strings it's looking up don't need to be in a resource. (cont'd) – Mike Dunlavey Sep 2 '11 at 22:14
@Robert: So while the air-wrench does a nice job of replacing the lug-wrench's functionality, profilers are not built on the same foundation of having a necessary job that they are making easier. They are built on the unsupported idea that what you need are statistics, when what you really need is something more like a debugger, if you consider that time spent unnecessarily is actually a bug. – Mike Dunlavey Sep 2 '11 at 22:22
Programmers are notoriously bad at knowing where the "hot spots" (the parts of code that contribute to poor performance in an application) are. Profilers are the tool of choice for finding those hotspots, not timers or debuggers. Especially if your application has one hundred thousand methods in it. – Robert Harvey Sep 2 '11 at 22:24
@Robert: and most performance problems are not hot spots. They are things being done for excellent-looking but not-really-necessary reasons. Like the strings example I gave. Like runaway notifications. In other words, a profiler can tell you which methods have high inclusive wall-clock time, but you can look at that and say "I don't see any way this could be improved". But a sample looked at in detail tells you the reason why - then you know what you need to do to fix the problem. Hey, if all you've got are hotspots, fine. IME, they are rare. – Mike Dunlavey Sep 2 '11 at 22:36
show 4 more comments

Not the answer you're looking for? Browse other questions tagged or ask your own question.