On Oct 15, 2010, at 06:20 , Andrew W. wrote:
That said, I’m wondering if there are any suggestions out there for
tutorials on using ruby-prof. Not tutorials like “here are what the numbers
mean”, but "here are some suggestions for looking at the numbers and
deciding where you’ll get the most gain in optimizing.
The biggie for me is to look at the values in the % column and see what
the curve is like:
% time call
% time call
In the first example, you have something more akin to a power law curve.
That says that a majority of the time is being spent in a minority of
the calls and is a good candidate for optimizing. You then need to look
and see if it is the number of calls that is causing it (which would
mean it is a good candidate for memoization or some other form of
caching) or if it is from accessing external resources that block or…
something. It is also a good candidate to use something like
zenprofile’s spy_on method to figure out where the calls are coming from
to determine the breakdown. If it is evenly distributed then it might
not actually be worthwhile to memoize. It really depends on the design
of the code and how it is used.
In the second example, while the times of the profile might be high, the
% of time spent is not… graphing that is pretty flat… it is
relatively linear with a fairly flat slope.