From: Jan Svitok Date: 2006-07-28T22:53:35+09:00 Subject: Re: Better profiling for ruby? I don't know whether this article fits into 'trivial' category or not: http://www-128.ibm.com/developerworks/edu/os-dw-os-ruby2-i.html (registration needed) J. On 7/28/06, Daniel Martin wrote: > 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? > >