Loop optimization

strtr strtr at spam.com
Sat May 15 16:42:36 PDT 2010


== Quote from Don (nospam at nospam.com)'s article
> 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.

Thanks!
NaNs being slower I can understand but inf might well be a value you want to use.

> > I used it as a null for structs.
> >



More information about the Digitalmars-d-learn mailing list