[Python-Dev] [ python-Patches-876206 ] scary frame speed hacks
Jeremy Hylton
jeremy at alum.mit.edu
Tue Mar 2 12:22:57 EST 2004
On Tue, 2004-03-02 at 12:17, Bob Ippolito wrote:
> Well it's already true to some small extent because of the recursion
> depth limit. Though, this has only been a problem for me once, and I
> rewrote it as a large ugly iterative version.
Don't know the particulars, but I thought it worth mentioning that the
recursion limit is set fairly conservatively. In many cases, it's
possible to boost the recursion limit. I don't know if it's ever
practical, because if something goes wrong you get a segfault.
Different kinds of recursive Python calls generated different numbers of
C stack frames. So if you have a recursive __repr__(), it will consume
more C stack than a simple Python function.
Python's recursion limit is set to 1000 in 2.3. On my box (RH9) the
first crash I get is with a recursion limit of 5800. It blows up on the
repr case. For simple recursive functions, I can push it all the way up
to 21,500.
Jeremy
More information about the Python-Dev
mailing list