boleary has asked for the wisdom of the Perl Monks concerning the following question:

I am using the Spreadsheet::Read to read a large XLSX spreadsheet
Without the Debugger, it takes 28 seconds to complete
With the Debugger it takes 78 seconds to complete

I've searched through the code to see if there were any DB specific settings but I don't see any
I really don't need any debugger access to the Spreadsheet module (at least not when I'm running this test)
I was wondering if there is a clever way to disable the debugger before a function call and re-enable it afterwards

  • Comment on Perl Debugger degrades performance when reading large spreadsheet

Replies are listed 'Best First'.
Re: Perl Debugger degrades performance when reading large spreadsheet
by Corion (Patriarch) on Aug 31, 2021 at 12:36 UTC

    To stop your program at a "good" place, you can enter the debugger at the interesting place using

    $DB::single = 1;

    Personally, I would first reduce the data read in from Spreadsheet::Read and/or replace it with static data to speed things up.

      Corion... Maybe I misunderstand your use of

      $DB::single=1

      To use that, doesn't the code needs to be loaded with the debugger?
      So every sub is already wrapped with a DB::sub() like Rolf suggests.
      and the whole script is already slowed down before I hit the $DB::single =1;

      If I don't load through debugger I get:

      Name "DB::single" used only once: possible typo at fix_ahdl_dcfx_const +raint_file.pl line 78.

      I can fix that warning by adding

      use DB;

      But I still can't interact with the debugger without running with the perl -d flag.

      Now I'm really done spending time on this :)
      But it has helped me understand the debugger a bit more.

        «…I'm really done…»

        See print for a human solution 🤪

        «The Crux of the Biscuit is the Apostrophe»

Re: Perl Debugger degrades performance when reading large spreadsheet
by LanX (Saint) on Aug 31, 2021 at 11:46 UTC
    The debugger is slow, that's a fact!

    It's using callbacks from DB:: namespace for each command, so you might be able to write wrappers for Spreadsheet::Read calls and locally replace those callbacks with faster dummies.

    No idea how much you'll gain.

    I also remember a YAPC talk from some Booking guys about speeding up the debugger, maybe it helps looking there.

    see also perldebug, perl5db, perldebguts

    edit

    Have also a look at DB::sub()

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      Thanks Rolf! With some further searching I found a module called Enbugger::perl5db
      It looks like it might be able to turn off/on the debugger
      Actually it turns on the debugger, but can't be used to turn it off..
      But that may be all I need :)