[Python-Dev] Usage of += on strings in loops in stdlib (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Wed Feb 13 00:39:23 CET 2013


On 13 Feb 2013 07:08, "Maciej Fijalkowski" <fijall at gmail.com> wrote:

Hi We recently encountered a performance issue in stdlib for pypy. It turned out that someone commited a performance "fix" that uses += for strings instead of "".join() that was there before. Now this hurts pypy (we can mitigate it to some degree though) and possible Jython and IronPython too. How people feel about generally not having += on long strings in stdlib (since the refcount = 1 thing is a hack)? What about other performance improvements in stdlib that are problematic for pypy or others? Personally I would like cleaner code in stdlib vs speeding up CPython.

For the specific case of "Don't rely on the fragile refcounting hack in CPython's string concatenation" I strongly agree. However, as a general principle, I can't agree until speed.python.org is a going concern and we can get a reasonable overview of any resulting performance implications.

Regards, Nick.

Typically that also helps pypy so I'm not unbiased.

Cheers, fijal


Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20130213/c6dcf198/attachment.html>



More information about the Python-Dev mailing list