SAITO@sdr.slb.com ("Naoki Saito Ext. 5471", GEO-002) (06/01/89)
Hello, folks! I installed gcc-1.34 on the Sun3 OS 4.0.1 system. I tried a simple math program and compared with Sun's C compiler. gcc was beaten by Sun's C in this case. I heard gcc-1.35 has inline functions for math library, but is there any way to improve the math computation speed without installing gcc-1.35? The following is the example and results. ====================================================================== /* mathtest2.c #include <stdio.h> #include <math.h> main() { int i; double x, y; for (i = 0; i < 10000; i++) { x = (double)i; y = log(exp(x)); } } =========================================================================== $ gcc -O -m68881 -o mathtest2.gcc mathtest2.c -lm $ cc -O -f68881 -o mathtest2.cc mathtest2.c -lm $ cc -O -f68881 -o mathtest2.cc.il mathtest2.c /usr/lib/f68881/libm.il $ /bin/time mathtest2.gcc 4.3 real 4.0 user 0.0 sys $ /bin/time mathtest2.cc 2.6 real 2.4 user 0.0 sys $ /bin/time mathtest2.cc.il 0.7 real 0.5 user 0.1 sys I would appreciate your advise! Naoki Saito (saito@sdr.slb.com) Schlumberger-Doll Research