Inherent code performance advantages of D over C?

Walter Bright newshound2 at digitalmars.com
Sun Dec 8 17:05:50 PST 2013


On 12/8/2013 4:47 PM, Timon Gehr wrote:
> Static analysis will tell you where a pointer might point to (more importantly,
> it may exclude aliasing) and what values the variable 'i' might have in it. How
> precise this information is hinges on the details of the analysis and the
> program it is applied on. I'm just saying that this may be more precise than
> what 'immutable' qualifiers give you (since those are quite easy to infer, given
> the program, and alias analysis may be non-trivial.)

There has been a lot of work trying to eliminate array bounds checking by 
figuring out the limits of i. This has met with only limited success.

I know of no C compiler that even attempts such things, and it certainly would 
be done if it was trivial.

"Proper" D code makes routine use of const and immutable, and so that 
information is effortlessly available to even simple optimizers.


More information about the Digitalmars-d mailing list