On 12/02/2014 07:49, wxjmfa...@gmail.com wrote:
Le mardi 11 février 2014 20:04:02 UTC+1, Mark Lawrence a écrit :
On 11/02/2014 18:53, wxjmfa...@gmail.com wrote:

Le lundi 10 février 2014 15:43:08 UTC+1, Tim Chase a écrit :

On 2014-02-10 06:07, wxjmfa...@gmail.com wrote:



Python does not save memory at all. A str (unicode string)



uses less memory only - and only - because and when one uses



explicitly characters which are consuming less memory.







Not only the memory gain is zero, Python falls back to the



worse case.







sys.getsizeof('a' * 1000000)



1000025



sys.getsizeof('a' * 1000000 + 'oe')



2000040



sys.getsizeof('a' * 1000000 + 'oe' + '\U00010000')



4000048







If Python used UTF-32 for EVERYTHING, then all three of those cases



would be 4000048, so it clearly disproves your claim that "python



does not save memory at all".







The opposite of what the utf8/utf16 do!







sys.getsizeof(('a' * 1000000 + 'oe' +



'\U00010000').encode('utf-8'))



1000023



sys.getsizeof(('a' * 1000000 + 'oe' +



'\U00010000').encode('utf-16'))



2000025







However, as pointed out repeatedly, string-indexing in fixed-width



encodings are O(1) while indexing into variable-width encodings (e.g.



UTF8/UTF16) are O(N).  The FSR gives the benefits of O(1) indexing



while saving space when a string doesn't need to use a full 32-bit



width.







A utf optimizes the memory and the performance at the same time.

It behaves like a mathematical operator, a unique operator for

a unique set of elements. Unbeatable.



The FSR is an exclusive or mechanism. I you wish to

same memory, you have to encode, and if you are encoding,

maybe because you have to, one loses performance. Paradoxal.



Your O(1) indexing works only and only because and

when you are working explicitly with a "static" unicode

string you never touch.

It's a little bit the the "corresponding" performance

case of the memory case.



jmf





Why are you so rude as to continually post your nonsense here that not a

single person believes, and at the same time still quite deliberately

use gg to post it with double line spacing.  If you lack the courtesy to

stop the former, please have the courtesy to stop the latter.



--

My fellow Pythonistas, ask not what our language can do for you, ask

what you can do for our language.



Nonsense?

sys.getsizeof('') - sys.getsizeof('a')
-1


The day you find an operator working on the set of
reals (R) and it is somehow "optimized" for N
(the subset of natural numbers), let me know.

A conflict is quickly appearing. Either the operator is
not correctly defined or the choice of the set is wrong.

You can replace the "operator" with an "encoding" and
the "set" with a "repertoire of characters".

It's the main reason, why we have to live today with
all these coding schemes. Even in more sophisticated
cases like, CID-fonts or "char boxes" in a pdf (with the
hope you understand how it works).

jmf


I ask you, members of the jury, to find the accused, jmf, guilty of writing nonsense and deliberately using google groups to double line space. The evidence is directly above and quite clearly prooves, beyond a resonable doubt, that no verdict other than guilty can be recorded. I rest my case, m'lud.

--
My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to