ruby-prof 0.7.0

I’m happy to announce the release of ruby-prof 0.7.0, the superfast, open-source, Ruby profiler that helps you find bottlenecks in your Ruby code. This release was a joint effort, with major contributions from Jeremy Kemper (aka bitsweat) of Rails fame and Hin Boen from CodeGear. There are two major new features in this release, as well as a number of smaller enhancements and bug fixes. For a full list of changes, take a look at the release notes.

The first major new feature is improved Rails profiling, which I’ll talk about in a separate post.

The second major feature is significant internal changes that make it easier to integrate ruby-prof with IDEs. ruby-prof is already being used by Aptana’s RadRails and has been integrated into the next version of Code Gear’s 3rd Rail. As part of this work, Hin has built a user interface for ruby-prof that lets a user inspect individual methods to see how much time they took as well as how they were called.

One big problem though, previous versions of ruby-prof only kept track of aggregate data. This made it impossible for Hin to create the user interface he wanted. For example, look at this call sequence:

     A
    / \
   B   K
  / \   \
 C   D   B
        / \
       C   D

With earlier versions of ruby-prof, there was no way to tell what percent of the time spent in method C was a result of the A -> B -> C call sequence versus the A -> K -> B -> C call sequence.

Or take another example:

  A    K
  |    |
  B    B
  |    |
  C    D	

In this case, if you tried to reconstruct the call sequence from ruby-prof you would end up with this incorrect result:

     A    K
     |  /
     B   
    / \ 
  C    D	

So working with Hin, I rearchitected ruby-prof to keep track of full call sequences. Most likely you won’t notice any difference – the changes will only affect you if you use ruby-prof’s api to present results in a custom way. In that case, you’ll have to update your code, which should only take a few minutes (to see the api in use, take a look at the various printer classes that ship with ruby-prof).

Enjoy, and all feedback is welcome.

Leave a Reply

Your email address will not be published. Required fields are marked *

Top