Loop optimization

Walter Bright newshound1 at digitalmars.com
Sun May 16 16:12:20 PDT 2010


Don wrote:
> bearophile wrote:
>> kai:
>>> Any ideas? Am I somehow not hitting a vital compiler optimization?
>>
>> DMD compiler doesn't perform many optimizations, especially on 
>> floating point computations.
> 
> More precisely:
> In terms of optimizations performed, DMD isn't too far behind gcc. But 
> it performs almost no optimization on floating point. Also, the inliner 
> doesn't yet support the newer D features (this won't be hard to fix) and 
> the scheduler is based on Pentium1.

Have to be careful when talking about floating point optimizations. For example,

    x/c => x * 1/c

is not done because of roundoff error. Also,

    0 * x => 0

is also not done because it is not a correct replacement if x is a NaN.


More information about the Digitalmars-d-learn mailing list