Mail Archives: djgpp/1997/05/18/07:05:21
KaRNaGE wrote:
>
> i searched the back mail, and from what i read, floats are faster then
> ints, on a pentuim?
Pentium's FPU is NOT faster than CPU. You can't compare those two
thinks, becouse they're complytly different and are being used for
different thinks. What makes pentium's FPU being usefull in some fast
real time calculations is the ability to execute float instructions in
parallel with integer. As the conseqence of this you can waste only 1
clock on arithmetic instructions (fmul is really faster than integer mul
- only 3 clocks!, integer 11 clocks). This can speed thinks a lot.
> ....before i convert all my code to floating point,
There is no need to convert all code to floating point, but only thinks
that can be really improved. You should mix integer with float point
(assembler is the key to really fast coding), but do different
calculations in both, avoid conversions from floats to ints, becouse
they are slow. CPU is much more faster when you don't need the fractal
part of the numbers and you are not using multipications and divisions,
except by the powers of 2.
It's better to use CPU, even when the calculation itself is slower, but
you need to convert result to integer to make use of it.
> i was wondering a few things:
>
> Are floats still faster then ints on a pentuim pro?
As far as I know, they are usefull in the same cases on PentiumPro as on
Pentium.
> Is comparing floats slower then comparing ints? i.e. if (a < b)
They are much more slower.
> will type casting floats to ints slow my code down?..
> and is triangle3d_f (allegro) faster then the fixed point version on a
> pentuim (i'm assuming it is)?
I don't use Allegro.
>
> i tried looking with the mail search engine, but i couldn't find any
> straight answers............thankz...
- Raw text -