On Monday 08 August 2005 16:02, Marc A. Volovic wrote: gcc -O2 -fno-math-errno -o /tmp/bnch1 /tmp/1.c -lm
See gcc(1) man page: -fno-math-errno Do not set ERRNO after calling math functions that are executed with a single instruction, e.g., sqrt. A program that relies on IEEE exceptions for math error handling may want to use this flag for speed while maintaining IEEE arithmetic compatibility. This option should never be turned on by any -O option since it can result in incorrect output for programs which depend on an exact implementation of IEEE or ISO rules/specifications for math functions. YMMV, but the difference between running with gcc 3.4.3 was huge: 1). No optimization: gcc -o /tmp/bnch-noop /tmp/drek.c -lm real 0m5.067s user 0m5.048s sys 0m0.018s 2). With -O2 (or -O3): gcc -O2 /tmp/bnch-O2 /tmp/drek.c -lm real 0m4.440s user 0m4.358s sys 0m0.001s 3). With -O2(or -O3) and -fno-math-errno: gcc -O2 -fno-math-errno -o /tmp/bnch-O2-no-math-errno /tmp/drek.c -lm real 0m0.228s user 0m0.226s sys 0m0.002s --Ariel > Example of an idiotic benchmark: > > int > main() > { > long long i; > double q; > > for (i=0; i<10000000; i++) { > q = sqrt(i); > } > } > > Under gcc 3.3.5 (Debian Sarge) this pile of drek executes in 1.4-1.8 > seconds (depending on -O level). Under icc 9.0 it executes between in > 3.4 seconds for -O0 and -O1, and in 0.015 seconds for -O2. > > And don't tell me this is not a valid benchmark. I know. This is as > artificial as I can get without using a wooden leg. > > M > > > ================================================================= > To unsubscribe, send mail to [EMAIL PROTECTED] with > the word "unsubscribe" in the message body, e.g., run the command > echo unsubscribe | mail [EMAIL PROTECTED] > > > +++++++++++++++++++++++++++++++++++++++++++ > This Mail Was Scanned By Mail-seCure System > at the Tel-Aviv University CC. -- -- Ariel Biener e-mail: [EMAIL PROTECTED] PGP: http://www.tau.ac.il/~ariel/pgp.html ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]