[pypy-issue] [issue926] string concatenation using + kills PyPy

Fijal tracker at bugs.pypy.org
Mon Nov 7 10:22:40 CET 2011

Fijal <fijall at gmail.com> added the comment:

It's not a time comparison - algorithm goes from linear to quadratic, it can go 
arbitrarily bad, depending on the size of the problem.

It's seriously obscure to emit a warning - the reason why people use this is 
precisely because CPython has an obscure hack there to optimize when refcount is 
one. If you have another reference to the same string, it becomes quadratic. 
Personally, I think linear-vs-quadratic difference based on refcount being one 
is a very obscure optimization to have.

Maybe we can introduce some special mode that will show you what went wrong in 
your program, however emitting warning by default is not good.

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list