[pypy-issue] Issue #1843: Repeated string concatenation performance (pypy/pypy)

Armin Rigo issues-reply at bitbucket.org
Tue Aug 12 09:38:45 CEST 2014


New issue 1843: Repeated string concatenation performance
https://bitbucket.org/pypy/pypy/issue/1843/repeated-string-concatenation-performance

Armin Rigo:

The following is clearly a bogus example, doing precisely what we should not do to concatenate a large list of small strings.  However, it is written in such a way that CPython's optimization doesn't work.  Nevertheless, CPython runs in 4.5 seconds but PyPy takes 24.6 seconds, which is more than 5x slower.

    lst = ["xy"] * 200000
    def f():
        y = ''
        for x in lst:
            y += x
            z = y
    f()





More information about the pypy-issue mailing list