The supposed inefficiency of recursive implementations is based largely on the properties of hardware that is now obsolete. With modern processors there's no great efficiency hit. In some of the smaller microcontrollers, it's true, you do have to worry about stack overflow; but the ARM processors, for example, provide plenty of stack space.

In the microcontroller world, the big performance hits come from the fact that the only available compilers are for C and sometimes C++. (And nobody uses assembly language except for the very little jobs.) The nature of the C language prevents compilers from doing optimisations that are standard in compilers for high-level languages. Most C compilers will, for example, always pass parameters on the stack, despite the generous supply of registers available in newer hardware.

However, some C compilers will *also* have one or more "go faster" calling conventions that pass parameters in registers, which can be employed. Over in the PC world, such "go faster" calling conventions are even the default calling convention if no calling convention is explicitly specified, for some C and C++ compilers.

http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/function-calling-conventions.html#Compiler http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/function-calling-conventions.html#Optlink http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/function-calling-conventions.html#Watcall

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to