Article View: comp.sys.sun
Article #11259libm for 68881 and Sun fpa is incredibly slow
From: prl
Date: Wed, 01 Mar 1989 09:10
Date: Wed, 01 Mar 1989 09:10
59 lines
1989 bytes
1989 bytes
If you use libm (especially trancendental functions sin(), cos(), ln(),
exp() etc..) you can get nearly a 10* speedup by using the clumsy code
inlining facility provided by Sun's C complier.
For example (on Sun 3/60, SunOS 4.0.1)
The following code:
#include <math.h>
main()
{
register int i;
register double x, y;
for(i = 0, x = 0; i < 100000; i++, x += 2*M_PI/100000.0)
y = cos(x);
}
Compiled with:
cc -O -f68881 -o cos cos.c -lm
Runs in:
real 0m30.16s
user 0m24.56s
sys 0m0.58s
Compiled with (but how incredibly *UGLY*):
cc -O -f68881 -o cos cos.c /usr/lib/f68881/libm.il
Runs in:
real 0m4.33s
user 0m3.65s
sys 0m0.20s
REASON:
Although Sun went to the trouble of making the assembly inline
file /usr/lib/f68881/libm.il, and a 68881 version of the
maths library, they *DID NOT* make assembly versions of
the maths functions to put into the maths library!
(and similarly for the FPA)
THIS IS STUPID!
NOTA BENE, Sun:
We discovered this while benchmarking Sony workstations. Trivial
loops with sin(), cos() etc. calls run 10* faster on the Sony
(20MHz, 68020 version) than on the Sun 3/60, without the need for
the inlining muck.
If Sony can do it right first time, why can't Sun get it right
on their Nth release after introducing the 68881?
Peter Lamb uucp: seismo!mcvax!ethz!prl
Tel: (01) 256 5241 (Switzerland) eunet: prl@iis.ethz.ch
+411 256 5241 (International)
Integrated Systems Laboratory
ETH-Zentrum
8092 Zurich
Technical Details
Message-ID:
<sw890217171845>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!husc6!rice!sun-spots-requestShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!husc6!rice!sun-spots-request From: prl@eiger.uucp Newsgroups: comp.sys.sun Subject: libm for 68881 and Sun fpa is incredibly slow Message-ID: <sw890217171845> Date: 1 Mar 89 09:10:49 GMT Sender: usenet@rice.edu Organization: Sun-Spots Lines: 59 Approved: Sun-Spots@rice.edu Original-Date: 17 Feb 89 17:20 +0100 X-Sun-Spots-Digest: Volume 7, Issue 174, message 13 of 15