More ANTS Profiler

My pleas were answered (thanks!) and I now have a Pro version of ANTS Profiler. I have mostly focused on memory usage over the last week trying to track down issues for our client. When the app started up, there was a long delay before we got UI-responsiveness. I figured this was just overhead from ANTS profiling it. I happened to run it without ANTS today and got the same result though, so something was blocking the UI thread for ~15 seconds during start-up.

When I was trying out ANTS last week, my sales rep at Red Gate talked up the performance profiling aspects quite a bit, so I decided to try tracking down my 15 seconds in ANTS. Unlike the memory profiling, which required some pre-sales support and hand-holding (though a token effort on my part to read the manual would probably have helped ;), the performance profiler was very straight-forward. Just start profiling in performance fast-mode and take a snapshot when slow things occur. After the 15-second lag passed and the UI started up again, I took a snapshot and saw this immediately:

This call is made to determine any timezone difference between the SQL Server and the client our app is running on. It’s called once for each server registered in the app, and for some reason this call to the single server I have registered took 14.47 seconds. Digging in further showed that GetServerTime() called RemoteTime() which was making native calls to NetRemoteTOD to get the time from the operating system, parsing out the timezone data returned, adding it to our current time to get the difference, etc. OS time retrieval works great if you have rights to the server itself, but I don’t so I lock up for 15 seconds before getting an “Access denied” return code. Changing GetServerTime() to just use our already-established SQL connection to call GETDATE() reduced the method call from 14.47s to 0.03s:

So that took about 10 minutes to find and fix, shaved about 14.4 seconds off each server call during start-up, and probably saved my client 3 hours of billable time had we tried to fix this by manually stepping through everything.

The downside, of course, being that it shaved off 3 hours of billable time. 😉

Leave a Reply

Your email address will not be published.