Does loading PDB slow down execution?

Dieter Maurer dieter at handshake.de
Wed Oct 6 13:30:33 EDT 2021


Unixnut wrote at 2021-10-3 22:03 +0100:
>If I run a python3 program with "import pdb" in the code, would it
>execute slower than without loading the debugger?

Importing `pdb` does not slow down the application significantly
(it just adds the import time but does not otherwise affect the
application).

Only when you execute code under debugger control, the
execution is significantly slowed down (because the debugger
gets informed (via callbacks) about important "event"s (entering
a line, function call, function return, exception) during
the execution).


More information about the Python-list mailing list