POV-Ray : Newsgroups : povray.unofficial.patches : Noisy thoughts : Re: Noisy thoughts Server Time
2 Sep 2024 04:14:07 EDT (-0400)
  Re: Noisy thoughts  
From: Vahur Krouverk
Date: 29 Sep 2000 12:27:33
Message: <39D4C343.D0AB9AC@aetec.ee>

> 

> >
> > Nathan Kopp wrote:
> > >
> > > Could this be done using shift operators (is the period a multiple of 2)?
> > >
> >         That only works once the double has been changed into a long, but there
> > might be something I can do there... I'll have to look at it in more
> > detail.
>         That did it! The time (with the range fix) is now at 461.67 :) I don't
> know why I had decided that it wouldn't work with negative numbers when
> I first looked at it. Of course the range is still limited to what a
> "long" can contain, but that's pretty big...
> 
Instead of shifting bit masking with & could be considered as well...


>         Now I've got an interresting puzzle: knowing that "x_ix" and "x_jx" are
> both doubles, why is this:
> x_jx = 1 - x_ix;
> faster than this:
> x_jx = 1.0 - x_ix;
> ??
> 
>         I would understand slower (since there is a conversion to do) or same
> speed (if the compiler is smart enough to do the conversion at compile
> time), faster??
> 
Generate assembler code and look at it, this might give hint. I tried it
with IBM compiler and only difference is the fact, that in first case
double value 1.0 (yes, compiler converted it to double) is put into same
segment as code, on second case it was put into constant segment. This
might be one reason (loading constant segment page into memory or
something like this).
But I won't count very much on this speed-up obtaining, as different
compilers on different platforms might give different results. More
clear would be using 1.0.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.