Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: English Idiom in Unix: Directory Recursively

Reply
Thread Tools

Re: English Idiom in Unix: Directory Recursively

 
 
Jonathan de Boyne Pollard
Guest
Posts: n/a
 
      05-21-2011
> 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./jonath....html#Compiler

http://homepage.ntlworld.com./jonath...s.html#Optlink

http://homepage.ntlworld.com./jonath...s.html#Watcall

 
Reply With Quote
 
 
 
 
Lars Enderin
Guest
Posts: n/a
 
      05-21-2011
2011-05-21 10:32, Jonathan de Boyne Pollard skrev:
>> 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./jonath....html#Compiler
>
>
> http://homepage.ntlworld.com./jonath...s.html#Optlink
>
>
> http://homepage.ntlworld.com./jonath...s.html#Watcall
>


Please include attributions, in this case for Peter Moylan and rusi!

 
Reply With Quote
 
 
 
 
Lars Enderin
Guest
Posts: n/a
 
      05-21-2011
2011-05-21 11:52, Lars Enderin skrev:
>
> Please include attributions, in this case for Peter Moylan and rusi!


Just Peter Moylan, sorry!

 
Reply With Quote
 
Lars Enderin
Guest
Posts: n/a
 
      05-21-2011
2011-05-21 11:54, Lars Enderin skrev:
> 2011-05-21 11:52, Lars Enderin skrev:
>>
>> Please include attributions, in this case for Peter Moylan and rusi!

>
> Just Peter Moylan, sorry!


Ignore the above.

 
Reply With Quote
 
Gerhard Fiedler
Guest
Posts: n/a
 
      05-21-2011
Jonathan de Boyne Pollard wrote:

>> 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.


I'm not sure this is a limitation of the C language. To me it is, if
this is indeed correct, a limitation of the currently available crop of
C compilers. ("Most" is always a difficult affirmation. You'd have to
review "all" in order to be able to say "most". And you'd forget about
relative importance of individual compilers.)

> However, some C compilers will *also* have one or more "go faster"
> calling conventions that pass parameters in registers, which can be
> employed.


Also, some C compilers do "whole program optimization" and with that can
tailor the calling code to the called code. There doesn't seem to be
anything in the C language spec that prohibits such things.

Gerhard
 
Reply With Quote
 
Seebs
Guest
Posts: n/a
 
      05-21-2011
On 2011-05-21, Gerhard Fiedler <> wrote:
> Jonathan de Boyne Pollard wrote:
>>> 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.


> I'm not sure this is a limitation of the C language.


It's not. It's not even true of C. It may be true of some ABIs, but
I have seen plenty which regularly use registers in their calling conventions.

> Also, some C compilers do "whole program optimization" and with that can
> tailor the calling code to the called code. There doesn't seem to be
> anything in the C language spec that prohibits such things.


There's not. Modern optimizations are pretty good.

I don't see any evidence to suggest that these are serious performance
hits.

-s
--
Copyright 2011, all wrongs reversed. Peter Seebach / usenet-
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.
 
Reply With Quote
 
Nobody
Guest
Posts: n/a
 
      05-22-2011
On Sat, 21 May 2011 11:33:09 -0300, Gerhard Fiedler wrote:

> Also, some C compilers do "whole program optimization" and with that can
> tailor the calling code to the called code. There doesn't seem to be
> anything in the C language spec that prohibits such things.


No, but the C language spec only addresses monolithic programs. Most
modern software development involves the use of dynamically-linked
libraries, which requires inter-module calls to conform to an ABI.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
English Idiom in Unix: Directory Recursively Xah Lee Python 108 05-30-2011 11:17 PM
Re: English Idiom in Unix: Directory Recursively Jonathan de Boyne Pollard C Programming 5 05-21-2011 06:37 PM
Is there a function that can test if a path is in a directory or oneof its sub-directory (recursively)? Peng Yu Python 0 11-06-2009 03:41 AM
I want to make English-speaking friend to practic my poor English IchBin Java 1 03-26-2006 05:36 AM
English/English DLL =?Utf-8?B?UmFlZCBTYXdhbGhh?= ASP .Net 2 10-16-2005 10:32 AM



Advertisments