New short blog post on the PyPy blog, bit of a PSA: Repeated string concatenation is quadratic on PyPy (and sometimes on CPython)

pypy.org/posts/2023/01/string-

#python #pypy

Follow

@cfbolz I wrote a blog post about this from the other side as well: blog.ganssle.io/articles/2019/

I was mildly surprised that it was quadratic in PyPy because in my smaller benchmarks it was always so fast anyway for realistic cases. 😅

@pganssle great post! Hadn't seen it before, and certainly much more careful benchmarking than mine. for not gigantic strings concatenation seems certainly fine (probably also because our allocations are likely much faster). But at some point the worse complexity catches up 😅

@pganssle also, now that I'm thinking again about the problem, I'm coming up with other potential ideas how to fix it 😅

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.