Skip to content

Commit cfd6b68

Browse files
committed
Add tip about debug overhead
1 parent 30bf23d commit cfd6b68

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

docs/commands/running.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,47 @@ program execution. You can:
1212
breakpoint is hit
1313
* step exection which is runs for a limited amount of code before stopping
1414

15+
About debugging overhead
16+
------------------------
17+
18+
Explain
19+
~~~~~~~
20+
21+
When you enable the debugger, it adds overhead and slows down your
22+
program. The overhead is greater than pdb, because the debugger tries to
23+
analyze the program in depth. In most cases, this does not diminish the
24+
debugging experience. But for some instructions, the overhead can be
25+
very large. For example, if you turn on the debugger and run the
26+
\`import pandas\` instruction, it can increase your CPU to 100% for a
27+
while.
28+
29+
The debugger overhead only concerns the instructions of the program to
30+
be debugged, the instructions of the trepan3k interpreter are not
31+
analyzed, so there is no overhead. For example, in trepan3k, do an
32+
\`import pandas\` and you will probably see that things are
33+
instantaneous.
34+
35+
Technique to reduce the overhead costs
36+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37+
38+
#. Activate the debugger only when you need it
39+
40+
Look at
41+
https://python3-trepan.readthedocs.io/en/latest/entry-exit.html#calling-the-debugger-from-your-program.
42+
By doing there is no slowdown whatsoever until the first breakpoint
43+
is hit.
44+
45+
#. Use debugging commands with less overhead
46+
47+
Not all commands have the same overhead.
48+
49+
Setting a breakpoint and running "continue" is faster than \`next\`
50+
command. Because \`next\` tries to be more accurate about nexting and
51+
that considerably slows things down.
52+
53+
Debugging commands
54+
------------------
55+
1556
.. toctree::
1657
:maxdepth: 1
1758

0 commit comments

Comments
 (0)