[no subject]
- To: mathgroup
- From: stevec (Steve Christensen)
- Date: Wed, 15 Mar 89 10:55:30 CST
>From att!twitch!rvk at uxc.cso.uiuc.edu
Subject: Mathematica and libm?
The following item was seen in a netnews group, and might
be of some interest to people in your area. I coded the
program, and get essentially the same results. while I don't
know whether the explanation supplied is correct or not, I am
wondering how something like this might affect packages like
Mathematica.
------------------------------------------------------------
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)