Larry Hastings wrote: > > John Machin wrote: > > try benchmarking this ... well "style" may not be the appropriate word > > Running this under Python 2.5 release: > x = [] > xappend = x.append > for i in xrange(10000000): > xappend("a") > y = "".join(x) > took 3281ms. > > Running this under my patched Python 2.5: > x = "" > xappend = x.__add__ > for i in xrange(10000000): > xappend("a") > y = "".join(x)
Don't you mean y = x[1] or something like that? y = "".join(x) looks like a copy-paste error. Playing the devil's advocate here: 10M adds each of a single byte followed by 1 render doesn't seem very typical. How about 10 adds each of 10 bytes followed by a render, then repeat that 10 M times. Another question: How does this: buff = "" for datum in data: if buff: buff += "|" buff += str(datum) compare with buff = "|".join(str(datum) for datum in data) ? Some of us have Windows boxes and don't have the necessary MS compiler. Is there any chance of someone making a 2.5+patch Windows binary? Cheers, John > took 3343ms. > > > /larry/ -- http://mail.python.org/mailman/listinfo/python-list