[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Debugger performance

John Lam

4/28/2005 7:03:00 PM

Are there any tips for optimizing the perf of the ruby debugger?I use:

ruby -r debug -rubygems foo.rb

Thanks
-John
http://www.iu...




4 Answers

Lothar Scholz

4/28/2005 11:35:00 PM

0

Hello John,

JL> Are there any tips for optimizing the perf of the ruby debugger?I use:

JL> ruby -r debug -rubygems foo.rb

JL> Thanks
JL> -John
JL> http://www.iu...

There is no real chance for the ruby debugger. But you can try the
debugger in arachno ruby (http://www.ru...). This is
implemented by patching the core interpreter and on heavy ruby
intensive tasks is upto 10x faster.

Arachno has two modes, a "quick debugger mode" where only the toplevel
stack frame (with the local variables) are shown, this mode gives you
the 10x performance increase and a slower mode which is about 5x
faster.


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




Andreas Schwarz

4/29/2005 10:33:00 PM

0

Lothar Scholz wrote:

> There is no real chance for the ruby debugger. But you can try the
> debugger in arachno ruby (http://www.ru...). This is
> implemented by patching the core interpreter and on heavy ruby
> intensive tasks is upto 10x faster.

How much slower than ruby without a debugger is that?

llothar

4/30/2005 6:19:00 AM

0


Andreas Schwarz wrote:
> Lothar Scholz wrote:
>
> > There is no real chance for the ruby debugger. But you can try the
> > debugger in arachno ruby (http://www.ru...). This is
> > implemented by patching the core interpreter and on heavy ruby
> > intensive tasks is upto 10x faster.
>
> How much slower than ruby without a debugger is that?

Do the simple test. Just assign an empty trace function via the
set_trace_function method and measure the performance. It depends so
much from your code base that there is no answer to the question.

If you parse a larger XML document with rexml, rubies pure XML parser,
this is about 60x slower, now add a few breakpoints and it is even
going worse.

Heavy regexpr based code may be only 3-5 times slower as most of the is
spend in C code.

vikkous

5/1/2005 1:27:00 AM

0

On Fri, 29 Apr 2005 09:35:16 +0900, Lothar Scholz wrote:
> Hello John,
>
> JL> Are there any tips for optimizing the perf of the ruby debugger?I use:
>
> JL> ruby -r debug -rubygems foo.rb
>
> JL> Thanks
> JL> -John
> JL> http://www.iu...
>
> There is no real chance for the ruby debugger. But you can try the

I have looked at the performance problems with debug.rb, (the slowness
was very annoying for me) and come to these conclusions:

1) debug.rb is slow because it uses set_trace_func. set_trace_func will
make anything slow.

2) Some features of a debugger (single-stepping, watchpoints probably)
require set_trace_func. But many cases are not. The user won't notice
slowness in single-stepping, and will just have to live with slow
watchpoints. But a lot of the time, you're just doing 'c' (continue) with
breakpoints set. Can we make that faster?

3) You could implement breakpoints via polymorphism as follows: figure out
what class and method the breakpoint is in. Override that method to enable
and disable set_trace_func as the debugger likes when the method is
entered and exited. Use the existing technique (in debug.rb) to detect
when you're at the line that actually has the breakpoint. set_trace_func
should be turned off most of the time this way, making for an order of
magnitude difference.

4) The watchpoints don't seem that useful. Are they watching values
instead of variables?

I wanted to make my own mini-debugger based on these ideas. Then I
decided it would be easier to patch debug.rb. Then I never figured out
enough about debug.rb to make it happen. It seems like this could be a
pretty easy patch.....

Ps: Lothar's way is probably better.