summing large arrays - or - performance of tight loops

Dave Dave_member at pathlink.com
Thu Apr 19 11:09:20 PDT 2007


Dan wrote:
> Craig Black Wrote:
> 
>>>  I think the "trust the compiler" philosophy is for stability (20 years 
>>> old), not optimizations.
>> Nope.  Read the documentation on foreach.  It says specifically that foreach 
>> is preferred over other looping mechanisms because the compiler will 
>> optimize it.
>>
>> -Craig 
> 
> I'm not going to change any foreach code over.  I'm going to wait until someone in Walter's group fixes it.  : )
> 

You might want to try it out first before making any judgments anyhow. I tried a couple of the 
benchmark tests and 'foreach' performed the same as 'array' for example. Mine were ran on a P4 chip 
and an AMD64 chip (original was Turion).



More information about the Digitalmars-d mailing list