2017-11-16 13:11 GMT+01:00 Antoine Pitrou
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@selma$ PYTHONMALLOC=debug ./python -X tracemalloc -i -m test test_os (...)
import tracemalloc; tracemalloc.get_traced_memory() (10719623, 10981725)
haypo@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