Bart

Software Engineer - Red Gate Software

Close Encounters: The Making of ANTS Profiler 4

Published Tuesday, September 02, 2008 5:00 PM

It’s out, it’s out, it’s out! After eight months of hard work ANTS Profiler 4 has figuratively hit the shelves, and if you’re reading this that means the product release team have put it up on our website at

http://www.red-gate.com/products/ants_profiler/index.htm


Hurrah! Now we can all relax on a beach somewhere, right?

Well, not exactly: we still have a memory profiler to build, which is a big job, and there’s plenty of other stuff going on as well. But let me tell you, after the “To all Red Gate - hey, we've done it” email that all project managers send at the end of a project, and that I’ve come to love sending, the first email I sent was to HR asking how much holiday I have left this year.

So what’s it been like? Well, overall great, and we’re all really happy with the result, which has made it all worth it, because in the middle, like any worthwhile endeavour, it had its rollercoaster moments. And a bit like running a marathon (disclaimer: I never have, and I never intend to), three quarters of the way through you hit something rather like the wall, and after that it’s all just a bit of a slog towards the release, but like I say, worth it in the end. Here are some of the highlights

The first is an email exchange that took place when Stephen sent around this screenshot of the nascent UI just after we’d slotted in a very early version of the timeline, under the title “It’s starting to come together”. (Click on the screenshots to see larger versions.)



Dom quickly replied with:

Looks like a close encounter…



And then Brian waded in with:

Or this:



Stephen’s reply:

Maybe that could be a secret game in ANTS 4!

I’ll ask Bart and see if he’s keen on some additional programming…


And then, after a surprisingly short period, Brian responded with this:

Funnily enough, we were just thinking the same thing....
 
Easter Egg :-)




And Dom again with:



That gave us all a laugh, but unfortunately we haven’t had time to embed a Defender clone into the timeline, although it would make an excellent Easter egg.

Then there’s the graph. Now this, as Stephen has already said, is the thing we spent the most time revising during the implementation phase. It was also the component that, at the green light, I’d suggested we would drop if we couldn’t get it right. We came up with great looking designs for it, but because it’s all so much to do with the interactivity, it’s not something we could convincingly capture in a paper prototype, and so when we ran the prototype against a few people the results weren’t inspiring. I remember one person saying, “Well it looks great, but what the **** is it for? I don’t see how this really helps me.” Actually, I think there was more swearing involved.

At any rate, somehow we blagged it through the greenlight—I think because we were up front about the risks, and also because I’d scheduled in three weeks just to mess around with the interactivity to avoid any nasty surprises. Predictably, when we started work on it, we still had no real clue about how it would behave; we had plenty of ideas but no way of knowing which would work. They all sounded great, but sometimes you have to suck it and see; some things we thought would work, actually didn’t at all, and overall it was very tricky to get right. Actually the process dragged on so long, and we spent so many hours sitting around talking about it, and tweaking things, that I was just about ready to can it completely: we were already looking at shipping in mid-August, rather than mid- to late-July, as originally planned—we’d invested a lot in the early access programme, and in incorporating the feedback we’d received so this wasn’t unplanned in that sense, but I was becoming enormously fed up with apparently making no progress on the graph.

Fortunately before doing anything rash we realised we were all too close to the problem, and that we needed some outside perspective on the matter, so we decided to stick what we had into the next early access build and run some remote usability sessions with it to see how people got on. I wasn’t sure what to expect, but already feeling pretty down about the whole thing, my hopes weren’t high.

We ran a couple of these sessions and got some useful feedback, on the basis of which we made a few more changes. Then Stephen and I ran another session. Our candidate profiled his application, and created a new call graph for one of his methods. We waited with baited breath… the call graph appeared... and his initial reaction wasn’t encouraging:

“Ohhhh, uh… hmm.”

Stephen and I exchanged a worried look, and there was a short pause. Then the candidate clicked on the node for the most expensive child method and, as it expanded, emitted this gleeful laugh. He carried on expanding other nodes and navigating around, with the first comprehensible words he uttered being,

“Incredibly sexy!”

From then on in it’s like a kid in a sweetshop as he continues to explore the graph, laughing, and making comments.

We realised that finally we had a winner on our hands. If it hadn’t been for the early access programme, and these remote usability sessions, something we thought was merely a “nice to have”, but which has become one of the killer features, would probably never have seen the light of day, or if it had, wouldn’t have worked nearly as well. Jason’s "sexy software" post was partially inspired by this incident.




The call graph. Right up there with Cameron Diaz in The Mask; Jim Carrey just called and he wants to dance.


Whilst all this was happening, Andrew was adding the events bar to the timeline.

Now even before we released the first early access build, some of our more intrepid developers had been sneakily grabbing builds from our build server to profile their own code, and by this time loads of people were getting in on the act. One of these was Daniel, who was (and is) working on SQL Response. He had a performance problem in a big chunk of code he’d inherited which he just couldn’t get to the bottom of. He’d tried ANTS Profiler 3, along with a couple of other products, and got nowhere, so he decided to give ANTS Profiler 4 a try. Fortuitously he picked one of the first builds with a functional events bar.

The events bar marks events such as button clicks, window activations and, crucially in this case, exceptions being thrown. It turned out that this particular bit of SQL Response was throwing lots of exceptions; hundreds and hundreds of them, over and over again, and they were being swallowed higher up in the code. Most of you are probably aware that exceptions can be expensive, and when this many are being thrown the effect on performance can be extreme. Daniel tracked down the code that was throwing the exceptions, and applied a fix to stop them happening in the first place, and hey presto! No more performance problem. Now it would be even easier because you can click on individual events, and the call tree will expand down through the relevant stack trace to the method where the event occurred.




The events bar. If this program was a mill, there’d be trouble at it.


Anyway, because a picture is worth a thousand words, here’s a montage of screenshots from ANTS Profiler 4, along with a couple from earlier versions of ANTS Profiler, for the sake of posterity.




ANTS Profiler 1.0, just in from February 2003.




ANTS Profiler 2 summary page, sporting an improved UI, and support for .NET 2.0.




ANTS Profiler 3 all methods grid. This version added support for x64, .NET 3.0, and .NET 3.5.




Bang up to date, with a typical ANTS Profiler 4 session showing an unexpected performance problem I’ve just found in Exception Hunter. It turns out that marshalling onto the main thread in this method is stealing loads of CPU time, and is happening far more often than needs be (you can see this from the source code view at the bottom). I’ll be fixing that later then.




Digging a little deeper I found that Breadcrumb.AnimationTimer_Elapsed is called by Timer.MyTimerCallback (I quickly created a call graph for AnimationTimer_Elapsed first, then created this new graph from the first one). This also shows that BreadcrumbBar.Timer_Elapsed is also using a significant chunk of CPU time. Again, by examining the source code I was able to determine that most of this is due to marshalling onto the main thread.




Here’s the new ANTS Profiler 4 methods grid, which not surprisingly confirms what I’ve already seen in the call tree and the graph. All of this goes to show that performance problems are often caused by things you wouldn’t necessarily expect.




Bookmarking and labelling the selected region for later. You can have as many bookmarked regions as you like. They are all highlighted along the top of the timeline and you can switch between them any time you like with a single click.


If you want to know more about how we went about developing ANTS Profiler 4 I’d recommend you take a look at this excellent series of articles by Stephen, our resident UI designer and usability expert:

http://www.simple-talk.com/dotnet/.net-tools/software-tool-design-the-three-rs/
http://www.simple-talk.com/dotnet/.net-tools/software-tool-design-design-by-sketching/
http://www.simple-talk.com/dotnet/.net-tools/software-tool-design-remote-user-testing/

In them he talks about how we went about researching for ANTS Profiler 4, designing the user interface using Bill Buxton's sketching method, and how cheap remote usability testing allowed us to incorporate user feedback throughout the project lifecycle.

If you haven’t seen quite enough screenshots yet there are a few more here:

http://www.simple-talk.com/dotnet/editors-corner/ants-4-beta-screenshots/

And throughout the project I’ve posted status updates such as these:

http://www.simple-talk.com/community/blogs/bart/archive/2008/05/12/52623.aspx
http://www.simple-talk.com/community/blogs/bart/archive/2008/07/08/61902.aspx
http://www.simple-talk.com/community/blogs/bart/archive/2008/08/07/66611.aspx

There is also Jason’s article, which I referenced above:

http://www.simple-talk.com/community/blogs/jcrease/archive/2008/06/03/58172.aspx

What more can I say? If you’re a .NET developer then I think you need a performance profiler, and I don’t think you’re going to find one better than ANTS Profiler 4. Find out more and download your 14-day fully functional free trial from:

http://www.red-gate.com/products/ants_profiler/index.htm

If you have any questions, comments or feedback, we'd love to hear from you. Please post them at:

http://www.red-gate.com/messageboard/viewforum.php?f=86
by Bart Read
Filed Under: ,

Comments

 

Jason Haley said:

September 3, 2008 9:21 AM
 

Reflective Perspective - Chris Alcock » The Morning Brew #172 said:

September 4, 2008 2:20 AM
You need to sign in to comment on this blog

About Bart Read

I've had a few jobs since graduating, but for the last four years I've been settled at Red Gate Software in Cambridge, UK. Over that time I've worked on a wide range of products, both as a developer and as a project manager, including 18 months on SQL Prompt; right now I'm finishing up with ANTS Profiler 4, which we think is going to be amazing - hopefully you will too.

















<September 2008>
SuMoTuWeThFrSa
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011
Virtual Exchange Servers
 Microsoft now supports running Exchange Server 2007 in server virtualization environments, not just on... Read more...

Virtualizing Exchange: points for discussion
 With the increasing acceptance of the use of Virtualization as a means of providing server... Read more...

Encouraging .NET Reflector Add-ins
 Jason Haley is well-known for the resources he's provided to developers who wish to extend Reflector's... Read more...

Using .NET Reflector Add-ins
 .NET Reflector by itself is great, but it really comes into its own with the help of some add-ins. Here... Read more...

Unique Experiences!
 You'd have thought that a unique constraint was an easy concept - Not a bit of it; it can cause a lot... Read more...