Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!husc6!rice!sun-spots-request From: prl@eiger.uucp Newsgroups: comp.sys.sun Subject: Re: libm for 68881 and Sun fpa is incredibly slow Message-ID: Date: 2 Mar 89 09:31:31 GMT Sender: usenet@rice.edu Organization: Sun-Spots Lines: 81 Approved: Sun-Spots@rice.edu Original-Date: 20 Feb 89 22:56 +0100 X-Sun-Spots-Digest: Volume 7, Issue 178, message 9 of 13 I have constructed a replacement for libm.a in which most of the C library routines have had their code replaced by code out of the inline replacement library. I will be making this code available in sun-spots or in comp.sources.sun (as appropriate), in a form which requires no distribution of Sun source or binaries, as soon as it has been tested locally. You can expect sqrt() to be more than 10 times faster in this library than in the standard -lm! The speedups are as follows (Sun3/280, SunOS 4.0.1): Motorola 68881 Func -lm -lmfast libm.il secs secs rel secs rel rel -lm -lm -lmfast cos() 9.43 1.85 5.10 1.67 5.65 1.11 sin() 8.87 1.77 5.01 1.65 5.38 1.07 tan() 12.98 1.97 6.59 1.83 7.09 1.08 acos() 5.13 2.37 2.16 2.27 2.26 1.04 asin() 6.40 2.37 2.70 2.20 2.91 1.08 atan() 9.22 1.82 5.07 1.70 5.42 1.07 log() 10.25 2.25 4.56 2.10 4.88 1.07 log10() 6.47 2.35 2.75 2.22 2.91 1.06 log2() 5.33 2.33 2.29 1.48 3.60 1.57 exp() 8.42 1.95 4.32 1.80 4.68 1.08 exp10() 9.37 2.12 4.42 2.02 4.64 1.05 exp2() 6.50 2.10 3.10 1.97 3.30 1.07 sqrt() 14.32 1.20 11.93 1.03 13.90 1.17 cosh() 4.82 2.23 2.16 2.10 2.30 1.06 sinh() 5.32 2.15 2.47 1.98 2.69 1.09 tanh() 5.57 2.33 2.39 2.23 2.50 1.04 atanh() 3.95 2.52 1.57 1.63 2.42 1.55 Weitek FPA Func -lm -lmfast libm.il secs secs rel secs rel rel -lm -lm -lmfast cos() 3.45 0.83 4.16 0.82 4.21 1.01 sin() 3.23 0.75 4.31 0.73 4.42 1.03 tan() 4.60 1.63 2.82 1.57 2.93 1.04 acos() 3.55 2.00 1.77 1.97 1.80 1.02 asin() 3.95 2.05 1.93 1.90 2.08 1.08 atan() 2.97 1.23 2.41 1.23 2.41 1.00 log() 4.42 1.27 3.48 1.28 3.45 0.99 log10() 4.17 2.07 2.01 1.93 2.16 1.07 log2() 3.43 1.93 1.78 1.95 1.76 0.99 exp() 3.15 1.42 2.22 1.25 2.52 1.14 exp10() 4.90 1.75 2.80 1.67 2.93 1.05 exp2() 3.32 1.75 1.90 1.68 1.98 1.04 sqrt() 12.37 1.18 10.48 1.18 10.48 1.00 cosh() 2.75 1.95 1.41 1.82 1.51 1.07 sinh() 3.03 1.75 1.73 1.68 1.80 1.04 tanh() 3.33 2.00 1.67 1.93 1.73 1.04 atanh() 2.32 2.12 1.09 2.10 1.10 1.01 NOTES: 1) -lmfast is my modified libm.a, libm.il is with the use of the Sun-supplied inline code file. 2) Columns entitled `rel' are the speedup relative to the named column. 3) The times for each routine are for 50000 calls, with parameter values in the range from slightly more than 0.0 to slightly more than 1.0, spaced linearly by 1.0/50000.0. 4) Loop overhead has been subtracted, but not subroutine call overhead. Peter Lamb uucp: uunet!mcvax!ethz!prl eunet: prl@ethz.uucp Tel: +411 256 5241 Integrated Systems Laboratory ETH-Zentrum, 8092 Zurich