StringChain -- a data structure for managing large sequences of chunks of bytes

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Fri Mar 12 22:06:52 EST 2010


On Fri, 12 Mar 2010 13:40:23 +0000, MRAB wrote:

>> To be taken seriously, I think you need to compare stringchain to the
>> list idiom. If your benchmarks favourably compare to that, then it
>> might be worthwhile.
>> 
> IIRC, someone did some work on making concatenation faster by delaying
> it until a certain threshold had been reached (in the string class
> implementation).

I believe you're talking about this patch:

http://bugs.python.org/issue1569040

It's never been formally rejected, but the chances of it being accepted 
are pretty low.


However, in Python 2.4 another optimization was added that makes string 
concatenation of the form:

a = a + b
a += b

much faster. This is implementation specific (Jython and IronPython don't 
have it, and almost certainly won't) and it doesn't work for (e.g.):

a = b + a

See here: 

http://mail.python.org/pipermail/python-dev/2004-August/046686.html
http://bugs.python.org/issue980695



-- 
Steven



More information about the Python-list mailing list