This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients belopolsky, loewis, pitrou, r.david.murray, rhettinger, serhiy.storchaka, vstinner
Date 2013-10-09.19:17:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1381346260.33.0.874691323529.issue19187@psf.upfronthosting.co.za>
In-reply-to
Content
Raymond> FWIW, I'm dubious that there will be any benefit from this at all.  The savings of one-pointer is the dictionary is likely to be insignificant compared to the size of the string object themselves.

As I wrote in python-dev, the dictionary is usually the largest memory block, at least at Python startup. The dictionary (without counting the string, just the dict) is between 192 KB and 1.5 MB on x86_64.

In the implementation of the PEP 454, issue #18874, I added a function to get the length and size of the dictionary of Unicode interned strings.

Objects/unicodeobject.c:

PyObject*
_PyUnicode_GetInterned(void)
{
    return interned;
}

tracemalloc.get_unicode_interned():

http://hg.python.org/features/tracemalloc/file/b797779940a5/Modules/_tracemalloc.c#l4606

You can use this function to see how many KB are saved. In embedded systems, every byte of memory counts :-)
History
Date User Action Args
2013-10-09 19:17:40vstinnersetrecipients: + vstinner, loewis, rhettinger, belopolsky, pitrou, r.david.murray, serhiy.storchaka
2013-10-09 19:17:40vstinnersetmessageid: <1381346260.33.0.874691323529.issue19187@psf.upfronthosting.co.za>
2013-10-09 19:17:40vstinnerlinkissue19187 messages
2013-10-09 19:17:40vstinnercreate