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.iunknown.com
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.