[Python-Dev] PEP 454 (tracemalloc) close to pronouncement
victor.stinner at gmail.com
Tue Nov 12 00:25:39 CET 2013
2013/11/11 Charles-François Natali <cf.natali at gmail.com>:
> After several exchanges with Victor, PEP 454 has reached a status
> which I consider ready for pronuncement : so if you have any last
> minute comment, now is the time!
Because the PEP has a long history, 49 mercurial revisions between
september and november 2013, I tried to summarize its history.
Most important changes of the PEP 454 between initial versions and the
current (final?) version:
- tracemalloc can store a whole traceback instead of just the filename
and line number of the most recent frame
- tracemalloc is no more a high-level tool, but a core module exposing
only one thing, traces on memory blocks, with a light Snapshot class
to compute statistics. Tasks, DisplayTop class, command line interface
and metrics have been removed.
- many functions and features with no real use cases were removed. For
example, get_trace(address) was taking a raw address, whereas such
address is not directly accessible in Python. It was replaced with
get_object_traceback(obj) which has a better API.
- better API providing access to all data from traces to statistics.
Raw traces are accessible via Snapshot.traces which generates
temporary read-only view to get an object API.
- minimalist API, ex: no more Snapshot.timestamp attribute
- no more "premature optimizations". For example, statistics are no
more computed during capture in C, but computed on a snapshot in
Charles-François did a great job to convert a high-level and
specialized tool to a reusage and generic module. Thanks for all your
advices! Without all these changes, it would be harder to extend
tracemalloc later and to reuse tracemalloc for different use cases.
More information about the Python-Dev