Blog "about python 3"

wxjmfauth at gmail.com wxjmfauth at gmail.com
Wed Jan 8 04:59:48 EST 2014


Le mercredi 8 janvier 2014 01:02:22 UTC+1, Terry Reedy a écrit :
> On 1/7/2014 9:54 AM, Terry Reedy wrote:
> 
> > On 1/7/2014 8:34 AM, wxjmfauth at gmail.com wrote:
> 
> >> Le dimanche 5 janvier 2014 23:14:07 UTC+1, Terry Reedy a écrit :
> 
> >
> 
> >>> Memory: Point 2. A *design goal* of FSR was to save memory relative  to
> 
> >>> UTF-32, which is what you apparently prefer. Your examples show that FSF
> 
> >>> successfully met its design goal. But you call that success, saving
> 
> >>> memory, 'wrong'. On what basis?
> 
> >
> 
> >> Point 2: This Flexible String Representation does no
> 
> >> "effectuate" any memory optimization. It only succeeds
> 
> >> to do the opposite of what a corrrect usage of utf*
> 
> >> do.
> 
> >
> 
> > Since the FSF *was* successful in saving memory, and indeed shrank the
> 
> > Python binary by about a megabyte, I have no idea what you mean.
> 
> 
> 
> Tim Delaney apparently did, and answered on the basis of his 
> 
> understanding. Note that I said that the design goal was 'save memory 
> 
> RELATIVE TO UTF-32', not 'optimize memory'. UTF-8 was not considered an 
> 
> option. Nor was any form of arithmetic coding
> 
> https://en.wikipedia.org/wiki/Arithmetic_coding
> 
> to truly 'optimize memory'.
> 
> 


The FSR acts more as an coding scheme selector than
as a code point optimizer.

Claiming that it saves memory is some kind of illusion;
a little bit as saying "Py2.7 uses "relatively" less memory than
Py3.2 (UCS-2)".

>>> sys.getsizeof('a' * 10000 + 'z')
10026
>>> sys.getsizeof('a' * 10000 + '€')
20040
>>> sys.getsizeof('a' * 10000 + '\U00010000')
40044
>>> sys.getsizeof('€' * 10000 + '€')
20040
>>> sys.getsizeof('€' * 10000 + '\U00010000')
40044
>>> sys.getsizeof('\U00010000' * 10000 + '\U00010000')
40044

jmf




More information about the Python-list mailing list