Lower than C?

Jesse Phillips jessekphillips at gmail.com
Thu Dec 6 08:37:46 PST 2007


On Thu, 06 Dec 2007 06:12:11 -0500, bearophile wrote:

> Jesse Phillips:
> 
> Thank you for your comments.
> 
>>That is to say the less specific something is described the more one can
>>optimize to build for it.<
> 
> But you need a quite more intelligent compiler to do (optimize) it, and
> to build a more intelligent compiler you need much more work and time.
> You can see how the Intel compiler optimizes compared to DMD, and the
> Intel compiler is quite primitive still compared to some of the things
> said in that article.
> 
> 
>>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.<
> 
> I am not advocating the creation of a new language between ASM and C.
> ASM can be used in D code already, but it may require too much work (the
> nice High Level Assembly too: http://webster.cs.ucr.edu/AsmTools/HLA/).
> And it looks like C is less and less able to use well the features of
> the modern CPUs. Sometimes even the VM of C# 3.0 is able to
> automatically use hardware better than "easy" C compiled with GCC... So
> maybe some things can be added to D to allow a better usage of the
> modern CPU, such things aren't useful for the whole program and for
> trivial tasks, but only for the small speed-critical parts of the D code
> where you may need max speed (like tight loops, etc) (where some people
> today are already using ASM in the middle of D code, so the readability
> my improve). (The disadvantage is this may increase the language
> complexity, but not much the compiler complexity).
> 
> Bye,
> bearophile

I realize you weren't suggesting a new language between ASM and C, but 
even so, going lower in D may not be the way to go. If you start writing 
the compiler to be specific to the current machines what about the future 
ones? Don't get me wrong, D should pick up what it can so that optimizing 
for today's computers is easier, but that doesn't mean it has to be 
closer to the hardware level to do it.

To me D already has a lot of syntax to help the compiler make good 
optimization decisions, I don't know if it really fully optimizes yet 
either. The fact that it is moving towards pure functions seems to be 
good for multi-core.



More information about the Digitalmars-d mailing list