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 {
>      PyObject_HEAD
>      Py_ssize_t length;
>      union {
>          void *any;
>          Py_UCS1 *latin1;
>          Py_UCS2 *ucs2;
>          Py_UCS4 *ucs4;
>      } data;
>      Py_hash_t hash;
>      int state;     /* may include SSTATE_SHORT_ASCII flag */
>      wchar_t *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

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to