Skip to content

Commit 9a2ee2e

Browse files
authored
Update running.rst
1 parent 21c34bb commit 9a2ee2e

1 file changed

Lines changed: 16 additions & 20 deletions

File tree

docs/commands/running.rst

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ Running
33

44
Running, restarting, or stopping the program.
55

6-
When a program is stopped there are several possibilities for further
6+
When a program is stopped, there are several possibilities for further
77
program execution. You can:
88

99
* terminate the program inside the debugger
1010
* restart the program
1111
* continue its execution until it would normally terminate or until a
1212
breakpoint is hit
13-
* step execution which is runs for a limited amount of code before stopping
13+
* step execution, which runs for a limited amount of code before stopping
1414

1515
About Debugging Overhead
1616
------------------------
@@ -19,23 +19,22 @@ Explanation of Problem
1919
~~~~~~~~~~~~~~~~~~~~~~
2020

2121
When you enable the debugger, there are callbacks made in the running
22-
of the program when certain events happen. Events are things occur in
22+
of the program when certain events happen. Events are things that occur in
2323
running the program, like when the code reaches a new line in the
24-
program, when a call or return occur, or when an exception is raised.
24+
program, when a call or return occurs, or when an exception is raised.
2525

2626
The overhead in running these callbacks slows down your
2727
program. Currently, the overhead can be greater than the overhead in
2828
``pdb``. This is because the debugger tries to be more precise and
29-
careful it tracing, and the features it provides are more powerful. In
30-
most cases, we can do this without a significatn slow down in the
29+
careful in its tracing, and the features it provides are more powerful. In
30+
most cases, we can do this without a significant slowdown in the
3131
debugged program.
3232

3333
But in certain situations, the overhead in running debugged code can
3434
be large. This happens when we want to "step over" a function that is
35-
large and complex like an ``import`` of a large module.
35+
large and complex, like an ``import`` of a large module.
3636

37-
For example, if you turn on the debugger and run the ``import pandas``
38-
instruction, it can increase your CPU for a while. ::
37+
For example, if you turn on the debugger and run the ``import pandas`` instruction, it can increase your CPU usage for a while. ::
3938

4039
$ cat slow.py
4140
#!/usr/bin/env python3
@@ -55,7 +54,7 @@ The debugger overhead only concerns the instructions of the program to
5554
be debugged, the instructions of the trepan3k interpreter are not
5655
analyzed.
5756

58-
Given this, here is how to speed up the above ::
57+
Given this, here is how to speed up the above ::
5958

6059
$ trepan3k slow.py
6160
(/tmp/slow.py:1): <module>
@@ -67,7 +66,7 @@ Given this, here is how to speed up the above ::
6766
(/tmp/slow.py:2 @10): <module>
6867
-- 2 print(pd)
6968

70-
Alternatively, modifying the program with a call to ``debug`` will also run fast ::
69+
Alternatively, modifying the program with a call to ``debug`` will also run fast::
7170

7271
$ cat fast.py
7372
#!/usr/bin/env python3
@@ -92,10 +91,9 @@ Techniques to Reduce Debugger Overhead
9291

9392
#. Remove keep breakpoints when you no longer need them
9493

95-
When there are *any* breakpoints in the program, the debugger has to
96-
check every event to see if the event is the target of a breakpoint.
94+
When there are *any* breakpoints in the program, the debugger has to check every event to see if the event is the target of a breakpoint.
9795

98-
In particular the ``continue``, ``finish``, and ``next`` (step over) commands are much slower.
96+
In particular, the ``continue``, ``finish``, and ``next`` (step over) commands are much slower.
9997

10098
Therefore, remove *all* breakpoints when they are no longer
10199
needed. Consider using temporary or one-time breakpoints when you need to stop only once.
@@ -105,20 +103,18 @@ needed. Consider using temporary or one-time breakpoints when you need to stop o
105103

106104
``continue`` when there are no breakpoints pending probably gives the
107105
fastest execution. ``info break`` will show you if there are any
108-
breakpoints. Recall that one-time breakopints are removed after they
106+
breakpoints. Recall that one-time breakpoints are removed after they
109107
are encountered.
110108

111-
When there are no breakpoints using the ``continue`` command will cause
112-
the debugger will remove its trace hook, and execution should continue at normal speed.
109+
When no breakpoints are used, the ``continue`` command will cause the debugger to remove its trace hook, and execution should continue at normal speed.
113110

114111
The ``step`` is usually fast, because there is generally very little
115112
debugger overhead between stopping points.
116113

117-
The ``next`` (step over) debugger command is faster without breakpoint
118-
than when there are breakpoint because without breakpoints there is
114+
The ``next`` (step over) debugger command is faster without a breakpoint than when there are breakpoint because without breakpoints, there is
119115
less debugger overhead in checking for the stopping condition.
120116

121-
The ``finish`` command when there are no breakpoint is faster than when there are breakpoints.
117+
The ``finish`` command when there are no breakpoints is faster than when there are breakpoints.
122118
Without breakpoints debugger will remove tracing calls.
123119

124120
When there must breakpoint in use, setting a breakpoint and running

0 commit comments

Comments
 (0)