delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/05/23:47:01

Message-ID: <32D09DEC.69DB@gbrmpa.gov.au>
Date: Mon, 06 Jan 1997 14:38:40 +0800
From: Leath Muller <leathm AT gbrmpa DOT gov DOT au>
Reply-To: leathm AT gbrmpa DOT gov DOT au
Organization: Great Barrier Reef Marine Park Authority
MIME-Version: 1.0
To: "Tony O'Bryan" <aho450s AT nic DOT smsu DOT edu>
CC: djgpp AT delorie DOT com
Subject: Re: Fixed Point (Optimization)
References: <Pine DOT SUN DOT 3 DOT 91 DOT 970105181744 DOT 22565V-100000 AT is> <32d0610c DOT 1680703 AT ursa DOT smsu DOT edu>

> 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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019