English Idiom in Unix: Directory Recursively

Peter Moylan invalid at peter.pmoylan.org.invalid
Wed May 18 21:06:06 EDT 2011


rusi wrote:
> On May 18, 5:09 pm, Peter Moylan <inva... at peter.pmoylan.org.invalid>
> wrote:
>> ObAUE: In common parlance, the English word "recursion" means pretty
>> much the same as what computing people call "iteration".  This might be
>> the first time I have ever found a point of agreement with Xah Lee.
> 
> Maybe the common usage mirrors the facts better than the lore that
> half-baked programmers remain devoted to. Consider first
> implementations:
> 
> The implementation of recursion by a typical language (eg gcc for C)
> maximizes generality at the cost of efficiency
> 
> The implementation of a very special case -- tail recursion -- in some
> special languages (most notably scheme) is required to be competitive
> with the iterative solution.
> 
> [If I remember right in Chez scheme tail recursion was more efficient
> than a do (iteration) because a do typically needed assignment and
> assignment was more expensive than parameter passing]

I believe the word "legend", or something equivalent, was used elsewhere
in this thread in this connection.  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.

-- 
Peter Moylan, Newcastle, NSW, Australia.      http://www.pmoylan.org
For an e-mail address, see my web page.



More information about the Python-list mailing list