A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-September/113602.html below:

[Python-Dev] PEP 393: Special-casing ASCII-only strings

[Python-Dev] PEP 393: Special-casing ASCII-only strings [Python-Dev] PEP 393: Special-casing ASCII-only stringsVictor Stinner victor.stinner at haypocalc.com
Thu Sep 15 23:04:16 CEST 2011
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

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4