Le 03/10/2011 04:19, Victor Stinner a écrit :
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.

Ok, bugs fixed, all "resize" optimizations are now enabled:

Python 3.3
str += str    : 119 ms
''.join()     : 130 ms
StringIO.join : 147 ms
StringBuilder : 404 ms
array('u')    : 979 ms

Hum, str+=str is now the fastest method, even faster than ''.join() !? It's maybe time to optimize str.join ;-)

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