[Python-ideas] Create a StringBuilder class and use it everywhere

ron3200 ron3200 at gmail.com
Thu Aug 25 18:24:06 CEST 2011


On Thu, 2011-08-25 at 18:28 +0300, k_bx wrote:


> The most popular (as from what I can see) thing right now where people start seeing
> that += is slow is when they try to do that on PyPy (which doesn't have hack like CPython,
> who is still slow) and ask "why my pypy code is sooooo slow".


I think a FAQ on "How can I make my python program faster?",  with
suggestions such as using list .join for building large strings instead
of using += would be better.   There probably already is one some
place...

Yep... 

http://wiki.python.org/moin/PythonSpeed/PerformanceTips


This in my opinion is more about fitting the code to the problem than it
is about speeding up general python code.  

I once wrote a text comparison engine that solved cryptograms by
comparing to a text source.   A large text source was read into a
dictionary of words to be compared to.  At first it was quite slow, but
by presorting the data and putting it into smaller dictionaries, it sped
up the program by several order of magnitudes.

Cheers,
    Ron

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110825/222f733f/attachment.html>


More information about the Python-ideas mailing list