(This section is of historical importance only; the old profiler
discussed here was last seen in Python 1.1.)
The big changes from old profiling module are that you get more
information, and you pay less CPU time. It's not a trade-off, it's a
trade-up.
To be specific:
- Bugs removed:
- Local stack frame is no longer molested, execution time is now charged
to correct functions.
- Accuracy increased:
- Profiler execution time is no longer charged to user's code,
calibration for platform is supported, file reads are not done by
profiler during profiling (and charged to user's code!).
- Speed increased:
- Overhead CPU cost was reduced by more than a factor of two (perhaps a
factor of five), lightweight profiler module is all that must be
loaded, and the report generating module (pstats) is not needed
during profiling.
- Recursive functions support:
- Cumulative times in recursive functions are correctly calculated;
recursive entries are counted.
- Large growth in report generating UI:
- Distinct profiles runs can be added together forming a comprehensive
report; functions that import statistics take arbitrary lists of
files; sorting criteria is now based on keywords (instead of 4 integer
options); reports shows what functions were profiled as well as what
profile file was referenced; output format has been improved.
Send comments on this document to python-docs@python.org.