Re:Python Patterns - An Optimization Anecdote
by RiderOfGiraffes on Tuesday November 02, 2010 @04:31AM
(#1859670)
> Not sure how fast that loop would be in Python
> compared to the implied loop&join but I sure
> would have liked to see them compared.
Why don't you try it and tell us the results?
Re:Python Patterns - An Optimization Anecdote
by StavrosK on Tuesday November 02, 2010 @06:19AM
(#1859800)
Yeah, seriously. "".join((chr(x) for x in chars)) would be the first thing I did (I'm not sure if comprehensions are faster than generators, they probably are, so I'd test for that as well.
Re:Python Patterns - An Optimization Anecdote
by Nitramp on Tuesday November 02, 2010 @09:51AM
(#1860380)
Indeed seems strange to micro optimize all that stuff without first fixing the obvious quadratic runtime part.
By the way, is there no mutable string object (à la Java's StringBuilder/Buffer) in Python?
Not sure how fast that loop would be in Python compared to the implied loop&join but I sure would have liked to see them compared.