[fa.info-vax] speed of single/double precision calculations

info-vax@ucbvax.ARPA (11/25/84)

From: Bill Mitchell <whm%arizona.csnet@csnet-relay.arpa>

Does anyone have approximate instruction timings for single and double
precision floating point operations on a 780?  I don't need anything extremely
accurate; the question I'm trying to answer is how much speedup might
result from doing all C floating point calculations in single precision
rather than double precision.

					Thanks,
					Bill Mitchell
					whm.arizona@csnet-relay
					{noao,mcnc,utah-cs}!arizona!whm

info-vax@ucbvax.ARPA (11/26/84)

From: Tony Li <Tli@Usc-Eclb>

    From: Bill Mitchell <whm%arizona.csnet at csnet-relay.arpa>

    Does anyone have approximate instruction timings for single and double
    precision floating point operations on a 780?  I don't need
    anything extremely 
    accurate; the question I'm trying to answer is how much speedup might
    result from doing all C floating point calculations in single precision
    rather than double precision.

These are some instruction timings that I have.  If you disregard the
time that C takes to do CVTFD and CVTDF, I'd say that you'd gain
roughly a factor of 4 or better.  These timings were done by Oregon
Software on a 780.  All times are in microseconds.  I don't know if
they had an FPA, but from the figures, I'd guess that they did.

Cheers, 
Tony ;-)

  ADD
                    40    ADDF2    Add F_floating 2 operand [1.60]
                    41    ADDF3    Add F_floating 3 operand [2.00]
                    60    ADDD2    Add D_floating 2 operand [7.80]
                    61    ADDD3    Add D_floating 3 operand [8.00]

  SUB

                    42    SUBF2    Subtract F_floating 2 operand [1.40]
                    43    SUBF3    Subtract F_floating 3 operand [1.80]
                    62    SUBD2    Subtract D_floating 2 operand [7.20]
                    63    SUBD3    Subtract D_floating 3 operand [7.40]

  MUL

                    44    MULF2    Multiply F_floating 2 operand [5.20]
                    45    MULF3    Multiply F_floating 3 operand [5.80]
                    64    MULD2    Multiply D_floating 2 operand [17.60]
                    65    MULD3    Multiply D_floating 3 operand [18.00]

  DIV

                    46    DIVF2    Divide F_floating 2 operand [7.60]
                    47    DIVF3    Divide F_floating 3 operand [8.20]
                    66    DIVD2    Divide D_floating 2 operand [42.80]
                    67    DIVD3    Divide D_floating 3 operand [43.00]

info-vax@ucbvax.ARPA (11/26/84)

From: Mike Minnich <mminnich@udel-ee>

Bill,

If you look at the compiler output, you'll see that floats always
are converted to doubles before any computation is done.  What's more,
after the computation, the doubles are converted back to float!

As a matter of fact, my office mate found that declaring everything
double resulted in a significant decrease in run time, esp. when
doing heavy duty floating pt computations.

Do everything in double, not float.

mike

info-vax@ucbvax.ARPA (11/27/84)

From: decvax!mcnc!rti-sel!rcb@BERKELEY

	I once ran a quick test that showed 10,000,000 single precision
multiplies at about 7 seconds and 10,000,000 doubles at 13 seconds.
A siginificant improvement.
					Randy Buckland
					Research Triangle Institute
					...!mcnc!rti-sel!rcb

info-vax@ucbvax.ARPA (11/28/84)

From: decvax!mcnc!rti-sel!trt@BERKELEY

Uhm, what computer/language were you using to time your code?
The Gould C/f77 compilers use single-precision arithmetic
on single-precision variables.
Most other compilers to all f.p. arithmetic in double
which means there is alot of float->double...arith...double->float
conversion which makes double precision variables look attractive!

The original definition of C was that all f.p. arithmetic
be in double precision, though the proposed standard
permits the Gould interpretation.
	Tom Truscott