Mail Archives: djgpp/1997/01/05/23:47:01
> My computer betrays me once again. I rewrote a simple timing program
> that merely calculates elapsed time using clock() and divides by
> CLK_TCK. _THIS TIME_ I ran it through 500,000 loops just adding 100.0
> to a type double accumulator. Once the floating point loop finished,
> I repeated the loop using a type long as my accumulator. On my
> Pentium 120, the floating point addition loop was roughly half as fast
> as the addition loop. The elapsed time was miniscule, not nearly the
> same results I had gotten previously.
It should be about half the speed. An FP add takes 3 cycles, and it
takes 1 cycle for an int add. Assuming normal simple loop overhead,
I would think it would take 4 cycles for an FP add loop, and 2 cycles
for an INT one...
Leathal.
- Raw text -