Derik Whittaker

Syndication

News


Performance Profiling your application is FTW

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

image

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

image

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

[Advertisement]

Comments

gOODiDEA.NET wrote Cheatsheet: 2011 12.13 ~ 12.19
on 12-18-2011 8:28 PM

.NET Just as the community got used to using using... Performance Profiling your application is FTW Using

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)