Hello Robert,


RK> "Brian Schröäer" <ruby / brian-schroeder.de> schrieb im Newsbeitrag
RK> news:20041201121041.6a44a927 / black.wg...
>> On Wed, 1 Dec 2004 08:12:52 +0900
>> Florian Gross <flgr / ccan.de> wrote:
>>
>> > Joe Van Dyk wrote:
>> >
>> > > I found the '-r profile' option.  Are there any better tools out
RK> there?
>> >
>> > What new features would they provide?
>> >
>>
>> Something I'm missing is to exclude certain statements and distinguish
RK> between
>> calls to the same method from different positions. If I profile any of
RK> my
>> progams I often get a result like
>>
>> 44.44     0.04      0.04        1    40.00    80.00  Array#each
>>
>> where I'm using different Array#each's that I don't want to have mixed.
RK> (E.g.
>> for setup and then for the routine I want to profile.)
>>
>> I could extract this cases into some extra class, but it would be nicer
RK> to tell
>> the profiler to discern between method call at line x and line y and not
RK> to
>> report method calls from line y.

RK> Although that's certainly desirable, I see these problems:

RK>  - the profiler does take away some performance already and I suspect this
RK> feature would lead to even greater slowdown.

Even at the moment the profiler is at a proof of concept level and absolute
unusable in programs that do a little bit more then "puts 'hello
world'". It slows down a program by at least a factor 50.

Every solution that is based on "set_trace_func" is in my opinion just
rubbish. try this with an empty proc and see how it slows down the
program and you will understand.

-----------------------------------
require "rexml/document"
$a = 0

set_trace_func proc { |event, file, line, id, binding, klass, *rest| 
  $a += 1 
}  

a = Time.new
doc = REXML::Document.new  File.new( "z:/work/eiffel/agui/build.eant" )
b = Time.new

print "Time : " , b - a, "\n"
print "Calls : " , $a, "\n"
-----------------------------------

Slows down 58 times. Add something more then a siple counter to
trace_func and you get 100 times slowdown. I have a prototype for a
ruby profiler for ArachnoRuby that only slows down 30% and gives much
much more detailed measurements.


-- 
 Best regards,                        emailto: scholz at scriptolutions dot com
 Lothar Scholz                        http://www.ruby-ide.com
 CTO Scriptolutions                   Ruby, PHP, Python IDE 's