[issue32771] merge the underlying data stores of unicodedata and the str type

STINNER Victor report at bugs.python.org
Tue Aug 13 08:23:29 EDT 2019


STINNER Victor <vstinner at redhat.com> added the comment:

> This will remove awkward maneuvers like ast.c importing unicodedata in order to perform normalization.

unicodedata is not needed by default. ast.c only imports unicodedata at the first non-ASCII identifier. If you application (and all dependencies) only use ASCII identifiers, unicodedata is never loaded. Loading it dynamically reduces the memory footprint. 

Raw measure on my Fedora 30 laptop:

$ python3
Python 3.7.4 (default, Jul  9 2019, 16:32:37) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.system(f"grep ^VmRSS /proc/{os.getpid()}/status")
VmRSS:	   10236 kB

>>> import unicodedata
>>> os.system(f"grep ^VmRSS /proc/{os.getpid()}/status")
VmRSS:	   10396 kB

It uses 160 KiB of memory.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32771>
_______________________________________


More information about the Python-bugs-list mailing list