[Python-Dev] [ python-Patches-876206 ] scary frame speed hacks

Josiah Carlson jcarlson at uci.edu
Tue Mar 2 11:56:07 EST 2004


> I would be cautious about anything that slows recursive functions becasue
> almost any interesting data structure traversal is recursive.  

Any recursion can be made iterative.  Sure, it can be a pain to do, but
it is always a good exercise.  See this thread for a generic and involved
example:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&safe=off&th=d04dcc083dc6d219&rnum=1

hierCodeTreePanel.new_heirarchy in the PyPE source code (pype.sourceforge.net)
also has an example.


Whether the patch should be made, I don't know, 20% slowdown is pretty
hefty.  Is this a result of the ideas for finding a fast calling
convention discussed recently?  If so, then it doesn't seem to be that
terribly fast (10% faster for standard functions, 20% slower on
recursive).  Any ideas on the speed of alternating recursions (each
level alternates between some small set of functions)?

 - Josiah




More information about the Python-Dev mailing list