D
Daniel Martin
So the recent performance threads have all repeated the wisdom
"profile first" in various forms, and various ways.
I have a problem with this. I can't read the output of the ruby
profiler and get meaningful insights on my script.
Invariably, the profiler will tell me that almost all of my time is
being sucked up in Range#each or Integer#upto. In other words, the
profiler is telling me that my time is being sucked up into some loop
somewhere. Thanks a bunch; any idea which of the twenty loops in my
program that is?
Over in the perl world, my favorite profiler has been
Devel::SmallProf. I've found there's nothing to compare with it for
producing those surprising "so *thats* where all my time has been
going" moments. It does this by giving me an easy feedback on which
lines of my program suck up the most time (both in terms of that line
directly and, if the line contains a sub call, the lines it calls).
I've found this line-number-based approach to profiling incredibly
helpful, much more helpful than traditional method-based summaries.
In fact, I found this approach so useful that I even implemented it
for java (http://perlmonks.org/?node_id=381641). This has been a real
blessing in my current job, allowing me to focus performance tuning at
a level that seems natural.
Now, is there any way to get this kind of information for ruby? I'd
like to be able to look at the output of a profiler and get some
information useful to making the script faster out of it. Barring
that, is there somewhere on the web a worked example of taking a
initial (nontrivial) ruby script, working with the profiler, and
ending up with a faster script?
"profile first" in various forms, and various ways.
I have a problem with this. I can't read the output of the ruby
profiler and get meaningful insights on my script.
Invariably, the profiler will tell me that almost all of my time is
being sucked up in Range#each or Integer#upto. In other words, the
profiler is telling me that my time is being sucked up into some loop
somewhere. Thanks a bunch; any idea which of the twenty loops in my
program that is?
Over in the perl world, my favorite profiler has been
Devel::SmallProf. I've found there's nothing to compare with it for
producing those surprising "so *thats* where all my time has been
going" moments. It does this by giving me an easy feedback on which
lines of my program suck up the most time (both in terms of that line
directly and, if the line contains a sub call, the lines it calls).
I've found this line-number-based approach to profiling incredibly
helpful, much more helpful than traditional method-based summaries.
In fact, I found this approach so useful that I even implemented it
for java (http://perlmonks.org/?node_id=381641). This has been a real
blessing in my current job, allowing me to focus performance tuning at
a level that seems natural.
Now, is there any way to get this kind of information for ruby? I'd
like to be able to look at the output of a profiler and get some
information useful to making the script faster out of it. Barring
that, is there somewhere on the web a worked example of taking a
initial (nontrivial) ruby script, working with the profiler, and
ending up with a faster script?