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-October/113803.html below:

[Python-Dev] RFC: Add a new builtin strarray type to Python?

[Python-Dev] RFC: Add a new builtin strarray type to Python? [Python-Dev] RFC: Add a new builtin strarray type to Python?Victor Stinner victor.stinner at haypocalc.com
Mon Oct 3 04:19:53 CEST 2011
Le dimanche 2 octobre 2011 15:25:21, Antoine Pitrou a écrit :
> I don't know why you're saying that. The concatenation optimization
> worked in 2.x where the "str" type also used only one memory block. You
> just have to check that the refcount is about to drop to zero.
> Of course, resizing only works if the two unicode objects are of the
> same "kind".

Oh, I see. In Python 2.7, bytes+=bytes calls PyMem_Realloc() on then writes 
the new characters to the result. It doesn't overallocate as bytearray (which 
overallocate +12,5%).

I restored this hack in Python 3.3 using PyUnicode_Append() in ceval.c and by 
optimizing PyUnicode_Append() (try to append in-place). str+=str is closer 
again to ''.join:

str += str: 696 ms
''.join():  547 ms

I disabled temporary the optimization for wstr string in PyUnicode_Resize() 
because of a bug. I disabled completly resize on Windows because of another 
bug.

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