Today one of our production ‘slowness’ issues finally came to a head and it was deemed a TOP priority which meant I actually had a legitimate reason to spend time working on it. The first think I did to attempt to find the issue was to fire up DotTrace from Jetbrains (killer app and very easy to use) and about 2 minutes later I had found the source of my bottle neck
Take a look at the 2 images below for an illustration of how simple it can be to find and SOLVE very large performance bottlenecks.
This is the original code. As you can see there are 12 calls (this is inside a loop) to a class called CMEHelperSupportsInstance which in total take up 141 SECONDS. Just for a bit of background this code is actually making a CORBA call across the wire to a Java server which we integrate with, which means I expect it to be a bit slow, but OMG 141 seconds slow….. GOD HELP ME

After making a very simple code change (more on that in a minute) here is the updated logic with perf numbers

As you can see from the above we are now only calling CMEHelperSupportsInstance 1 time for a savings of about 134 total seconds. What I found was that we were creating an instance of this class for EVERY iteration of a loop, which as I explained above was VERY expensive. I moved the creation of this to outside the loop and passed the instance around. This was a very simple fix but had it not been for the perf tool showing me exactly how expensive.
It is always important to make sure your application is performing as expected but without the right tools and without knowing where to look it is often very hard to find and diagnose where you have performance issues. If you have an idea of where you have issues and you have a too like DotTrace (or any other .net profiler for that matter) finding and solving issues can be very simple and very rewarding it.
Till next time,
Posted
12-13-2011 7:04 PM
by
Derik Whittaker