epony has quit [Remote host closed the connection]
epony has joined #pypy
riverboard has joined #pypy
<riverboard>
Hi everyone, I've been writing a lot of algorithms in Python and noticed interesting behavior. pypy 7.3.14 cannot deal with recursion, even though sys.setrecursionlimit(9**9) is set. When it can deal with it, it is slower than CPython. Is this expected?
<riverboard>
What I mean by not dealing with it, I get segmentation fault.
<mattip>
riverboard: what is your workload? Are you using c-extensions (NumPy, SciPy ...)?
<riverboard>
Just plain Python, no libraries. I'm solving problems here https://cses.fi/problemset/list/ and have to avoid recursion almost everywhere. Similarly, when I see someone's Python solution using recursion, I can provide a test case that breaks it (with a runtime error). But when the stack will be small (~10^5 recursive calls) I always get better performance with CPython.
<riverboard>
I am running the programs locally with the latest pypy3 (the one on the cses is older) and still encounter similar issues. The older pypy version on CSES is also better at recursion and programs that fail on my machine won't fail on the CSES server.
<mattip>
it is not expected that pypy will segfault, and also not expected that it will be slower than CPython for pure python work