Skip to content

Commit d7706e6

Browse files
committed
fixup! fixup! Add docs
1 parent 0c7b1f1 commit d7706e6

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

Doc/library/profile.rst

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,6 @@ Python programs. A :dfn:`profile` is a set of statistics that describes how
2424
often and for how long various parts of the program executed. These statistics
2525
can be formatted into reports via the :mod:`pstats` module.
2626

27-
**Profiler Comparison:**
28-
29-
+-------------------+----------------------+----------------------+----------------------+
30-
| Feature | Statistical | Deterministic | Deterministic |
31-
| | (``profile.sample``) | (``cProfile``) | (``profile``) |
32-
+===================+======================+======================+======================+
33-
| **Target** | Running process | Code you run | Code you run |
34-
+-------------------+----------------------+----------------------+----------------------+
35-
| **Overhead** | Virtually none | Moderate | High |
36-
+-------------------+----------------------+----------------------+----------------------+
37-
| **Accuracy** | Statistical approx. | Exact call counts | Exact call counts |
38-
+-------------------+----------------------+----------------------+----------------------+
39-
| **Setup** | Attach to any PID | Instrument code | Instrument code |
40-
+-------------------+----------------------+----------------------+----------------------+
41-
| **Use Case** | Production debugging | Development/testing | Profiler extension |
42-
+-------------------+----------------------+----------------------+----------------------+
43-
| **Implementation**| C extension | C extension | Pure Python |
44-
+-------------------+----------------------+----------------------+----------------------+
45-
46-
.. note::
47-
48-
The statistical profiler (:mod:`profile.sample`) is recommended for most production
49-
use cases due to its extremely low overhead and ability to profile running processes
50-
without modification. It can attach to any Python process and collect performance
51-
data with minimal impact on execution speed, making it ideal for debugging
52-
performance issues in live applications.
53-
5427
The Python standard library provides three different profiling implementations:
5528

5629
**Statistical Profiler:**
@@ -80,6 +53,34 @@ The Python standard library provides three different profiling implementations:
8053
but not for C-level functions, and so the C code would seem faster than any
8154
Python one.
8255

56+
**Profiler Comparison:**
57+
58+
+-------------------+----------------------+----------------------+----------------------+
59+
| Feature | Statistical | Deterministic | Deterministic |
60+
| | (``profile.sample``) | (``cProfile``) | (``profile``) |
61+
+===================+======================+======================+======================+
62+
| **Target** | Running process | Code you run | Code you run |
63+
+-------------------+----------------------+----------------------+----------------------+
64+
| **Overhead** | Virtually none | Moderate | High |
65+
+-------------------+----------------------+----------------------+----------------------+
66+
| **Accuracy** | Statistical approx. | Exact call counts | Exact call counts |
67+
+-------------------+----------------------+----------------------+----------------------+
68+
| **Setup** | Attach to any PID | Instrument code | Instrument code |
69+
+-------------------+----------------------+----------------------+----------------------+
70+
| **Use Case** | Production debugging | Development/testing | Profiler extension |
71+
+-------------------+----------------------+----------------------+----------------------+
72+
| **Implementation**| C extension | C extension | Pure Python |
73+
+-------------------+----------------------+----------------------+----------------------+
74+
75+
.. note::
76+
77+
The statistical profiler (:mod:`profile.sample`) is recommended for most production
78+
use cases due to its extremely low overhead and ability to profile running processes
79+
without modification. It can attach to any Python process and collect performance
80+
data with minimal impact on execution speed, making it ideal for debugging
81+
performance issues in live applications.
82+
83+
8384
.. _statistical-profiling:
8485

8586
What Is Statistical Profiling?

0 commit comments

Comments
 (0)