[Python-Dev] PEP 393: Special-casing ASCII-only strings (original) (raw)
Victor Stinner victor.stinner at haypocalc.com
Thu Sep 15 23:04:16 CEST 2011
- Previous message: [Python-Dev] PEP 393: Special-casing ASCII-only strings
- Next message: [Python-Dev] PEP 393: Special-casing ASCII-only strings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Le jeudi 15 septembre 2011 17:50:41, Martin v. Löwis a écrit :
In reviewing memory usage, I found potential for saving more memory for ASCII-only strings. (...)
typedef struct { PyObjectHEAD Pyssizet length; union { void *any; PyUCS1 *latin1; PyUCS2 *ucs2; PyUCS4 *ucs4; } data; Pyhasht hash; int state; /* may include SSTATESHORTASCII flag */ wchart *wstr; } PyASCIIObject;
I like it. If we start which such optimization, we can also also remove data from strings allocated by the new API (it can be computed: object pointer + size of the structure). See my email for my proposition of structures: Re: [Python-Dev] PEP 393 review Thu Aug 25 00:29:19 2011
You may reorganize fields to be able to cast PyUnicodeObject to PyASCIIObject.
Victor
- Previous message: [Python-Dev] PEP 393: Special-casing ASCII-only strings
- Next message: [Python-Dev] PEP 393: Special-casing ASCII-only strings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]