Lower than C?

Jesse Phillips jessekphillips at gmail.com
Wed Dec 5 19:03:04 PST 2007


On Wed, 05 Dec 2007 13:25:54 -0500, bearophile wrote:

> You have have read this already, but I have found it interesting:
> http://my.opera.com/Vorlath/blog/2007/10/07/wasted-power
> 
> They show me why D may enjoy gaining some things at a level even lower
> than C, to allow it to use the modern CPUs better. There one comment by
> spc476 reminds me that D can actually have vector ops too someday ;-) I
> think it may exist a language that is both safe enough and allows to
> give hints to the compiler with a nice syntax to allow some of the
> optimizations that article discusses a lot about.
> 
> Bye,
> bearophile

If you look at the comments, someone said that the problem is C is too 
low level. I happen to mostly agree with is. I will use a non-computer 
related example.

I ask you to build me a 1991 Handa Civic CRX. This is nice and low level, 
you know exactly what I want, which will dictate what parts you use to 
build it. Now I ask for fast transportation from point A to point B. 
Well, you probably wouldn't build a CRX, maybe you'd go for a dragster. 
But you know what I want to get somewhere fast so you might even build an 
airplane.

That is to say the less specific something is described the more one can 
optimize to build for it. The problem comes in that the compiler has to 
have good reasoning as to what is being asked and thus where it can be 
optimized. I think D does a good job of telling the compiler what it 
needs to do without giving it too much detail.

I would also like to say that going to a language lower that C is working 
backwards. There was a reason languages have begun to abstract hardware 
features in cost to efficiency. Its to much coding for trivial things. It 
sounds as though he wanted a code base where people could take optimized 
code for these trivial tasks. My question is why doesn't he start this, 
he already has a language, asm is the lower level C.

Don't get me wrong, it is important to know how interaction with hardware 
works, and where optimization can be added at that level. With that means 
that one has to understand the compiler they're using and how it 
optimizes code one writes so that he knows where he can manually optimize.



More information about the Digitalmars-d mailing list