Search code examples
perldebuggingcompilation

Is Perl slower when compiled with DDEBUGGING?


According to this slide from Supercharging Perl - Daina Pettit,

enter image description here

It reads,

Avoid versions of perl compiled with threading or DDEBUGGING unless you know you need them.

I know most distros compile Perl with threading, but my Perl on Debian (as observed with perl -V_ is compiled with -DDEBUGGING=-g does this slow it down?


Solution

  • Perl with debugging enabled is slower.,

    Note that a perl built with -DDEBUGGING will be much bigger and will run much, much more slowly than a standard perl.

    However, -DDEBUGGING=-g does not enable debugging:

    As a convenience, debugging code (-DDEBUGGING) and debugging symbols (-g) can be enabled jointly or separately using a Configure switch, also (somewhat confusingly) named -DDEBUGGING. For a more eye appealing call, -DEBUGGING is defined to be an alias for -DDEBUGGING. For both, the -U calls are also supported, in order to be able to overrule the hints or Policy.sh settings.

    and also documented:

    Configure -DEBUGGING=-g

    Adds -g to optimize, but does not set -DDEBUGGING. (Note: Your system may actually require something like cc -g2. Check your man pages for cc(1) and also any hint file for your system.)


    You can test status with: perl -D, if you see the following you do not have -DDEBUGGING,

    Recompile perl with -DDEBUGGING to use -D switch (did you mean -d ?)