Loop optimization

Don nospam at nospam.com
Sat May 15 12:48:18 PDT 2010


strtr wrote:
> == Quote from bearophile (bearophileHUGS at lycos.com)'s article
>> But the bigger problem in your code is that you are performing operations on
> NaNs (that's the default initalization of FP values in D), and operations on NaNs
> are usually quite slower.
> 
> I didn't know that. Is it the same for inf?

Yes, nan and inf are usually the same speed. However, it's very CPU 
dependent, and even *within* a CPU! On Pentium 4, for example, for x87, 
nan is 200 times slower than a normal value (!), but on Pentium 4 SSE 
there's no speed difference at all between nan and normal. I think 
there's no speed difference on AMD, but I'm not sure.
There's almost no documentation on it at all.


> I used it as a null for structs.
> 


More information about the Digitalmars-d-learn mailing list