A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-November/150578.html below:

[Python-Dev] Add a developer mode to Python: -X dev command line option

[Python-Dev] Add a developer mode to Python: -X dev command line option [Python-Dev] Add a developer mode to Python: -X dev command line optionVictor Stinner victor.stinner at gmail.com
Thu Nov 16 07:48:41 EST 2017
2017-11-16 13:11 GMT+01:00 Antoine Pitrou <solipsis at pitrou.net>:
> Could you measure and perhaps document the expected effect on
> performance and memory consumption?
> (it can be a very rough ballpart estimate)

Currently "python3 -X dev script.py" behaves as "PYTHONMALLOC=debug
python3 -W default -X faulthandler script.py".

faulthandler has a negligible cost on performance/memory.

For -W default, I guess that your question is the cost on emitting a
warning: overhead when a warning is displayed, and overhead when the
warning is filtered. Right?

IMHO the most expensive check is PYTHONMALLOC=debug which increases a
lot the memory usage.

You can measure the difference using tracemalloc and PYTHONMALLOC:

haypo at selma$ PYTHONMALLOC=debug ./python -X tracemalloc -i -m test test_os
(...)
>>> import tracemalloc; tracemalloc.get_traced_memory()
(10719623, 10981725)

haypo at selma$ PYTHONMALLOC=debug ./python -X tracemalloc -i -m test test_os
(...)
>>> import tracemalloc; tracemalloc.get_traced_memory()
(10724064, 16577338)

For example, on test_os, PYTHONMALLOC=debug increases the peak memory
usage from 10.5 MiB to 15.8 MiB: +50%.

PYTHONMALLOC=debug adds 4 * sizeof(size_t) bytes to each allocated
memory block. For example, an empty tuple uses 64 bytes, but
PYTHONMALLOC=debug allocates 96 bytes (+ 32 bytes) in 64-bit mode.

Victor
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4