Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!sdr.slb.com!SAITO From: SAITO@sdr.slb.com ("Naoki Saito Ext. 5471", GEO-002) Newsgroups: gnu.gcc Subject: slow math computation in gcc-1.34 Message-ID: <8906011741.AA09171@AENEAS.MIT.EDU> Date: 1 Jun 89 16:26:00 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 40 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 #include 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