Faster Perl debugging through crazy tricks?

Hi all,

I'm at work right now, waiting for some code to run in the Perl Debugger and I got to thinking. Right now I've set a break point and I've hit "c" for continue executing, and in the background the debugger is doing all these checks on every single line and slowing down the execution of my program like crazy. I know it's doing something because if I hit ^C is halts properly at its current point of execution. What if there were some way to speed this up?

I'm thinking...

DB > b $condition
DB > $DB::breakpoints_only_mode = 1;
DB > c

Setting $DB::breakpoints_only_mode essentially promises the debugger that you won't hit ^C or anything silly like that. The implementation would be something like...

  • Set up a hook of some kind for all existing breakpoints, which turns debugger flags on, then checks the breakpoint, then turns debugger flags back off again.
  • Turn off the debugger flag(s?)
  • Continue running the code as normal

What do Smarter People Than Me think of this idea?

(of course it's entirely possible that the debugger isn't actually slowing down my code all that much... but it feels like it is?)

2 Comments

In my experience the debugger is only really slow when $DB::single is true. I'm not sure if it's possible to turn it off with perl5db.pl, but doing so accomplishes basically what you want.

> (of course it's entirely possible that the debugger isn't actually slowing down my code all that much... but it feels like it is?)

Benchmark it? :)

Leave a comment

About Alex Balhatchet

user-pic CTO at Lokku Ltd.