NProf saves the day...

Today did not start as a good day.  After considerable time in development (months), a major component of our project was put under load-test yesterday and left to run overnight.

The "load" in this case was a trivial load, a fraction of our daily business at the current time.  That trivial amount of load took 11 hours to process, which I was informed at 8:30 AM this morning.  I was not a happy architect.  So with thousands of lines of code to consider, my first step was a manual quick-scan looking for blatant problems.  In retrospect, I shouldn't have done this.  It yielded some results, but missed the mark on the big issue (even if the DB access inside the component did have considerable problems).

So I went off in search of a profiling tool, something that could help me isolate the problem.  Google resulted a top hit on NProf, a link from Larkware by Mike Gunderloy who I read religously where he had reviewed this tool.  I set it to work on a simple executable I wrote to create an isolated test of this component (yes, I had a Unit Test Library, no I didn't want to spend the time to figure out how to make it work with NUnit just then).  The offending method popped up in the results very nicely, and has been slated for immediate refactoring tommorow.

Of particular note is that this profiler does not stop at calls to your code, but traces the entire framework during your application run.  As such I know not only which method of mine is offending, but which of the methods it calls offends the most, etc, etc, etc.

As a side note, that code calls the String.get_Chars(int32) some 238 MILLION times in the course of it's 5 minute run.  And that only accounted for 2.54 percent of the total time.