Closed utterances-bot closed 1 year ago
Nice & good written. Makes you think.
Also like the “explain why not fix” part
It's funny - I'm working back through old AOCs and doing this exact problem I googled for "pypy slow string concatentation" after trying ''.join(L) in the mentioned place and getting the same results...
While this use-case is perhaps pathological, I've sorta become accustomed to using += since it's often not a bottleneck in CPython since maybe about python 2.6. Having an alternate runtime with a markedly different performance result on what one might consider innocuous looking code is interesting.
Repeated string concatenation is quadratic in PyPy (and CPython) | PyPy
https://www.pypy.org/posts/2023/01/string-concatenation-quadratic.html