This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
FW: very very very slow when optimized
- From: "Atwood, Robert C" <r dot atwood at imperial dot ac dot uk>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Fri, 18 Nov 2005 19:10:47 -0000
- Subject: FW: very very very slow when optimized
Dear List:
We have some software , mostly written by me, in C , that seems to
become very very slow when optimized. The user (who has also written
some of the routines) complained that it was taking longer than it
should -- but when compiled for debugging without any -O options and
with -g suddenly it was much faster! (34 seconds instead of 500
seconds!)
So far we have repeated a test case
using gcc 3.3.3 gcc (GCC) 3.3.3 (SuSE Linux)
with:
-O3 -march=nocona (slow)
-O3 (slow)
-O2 (slow)
[no -O flag] (fast)
-g (fast)
and then with self-built gcc4.0.2 that I just compiled, with similar
results
gccv4 (GCC) 4.0.2 Copyright (C) 2005 Free Software Foundation, Inc.
-O3 (slow)
-g (fast)
This is on a dual Intel em64t Xeon running Suse gnu/linux 9.1 + "yast
online updates" , Linux kernel 2.6.5-7.151-smp from Suse, The machine
has 8Gb memory and the job uses about 2Gb as seen in the Top output:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
14454 someuser 39 19 2153m 1.2g 1296 R 99.9 15.6 132:57.79 my_program
I suggested also trying -m32 and also building and running on another
machine that has ia32 (Pentium 4 Xeon) processors also using gcc-3.3.3
(not Suse though, I compiled it on the Red hat machine) but .. he's gone
home for the day...
Before I spend more time attempting to locate the problem, perhaps
someone can recommend how I can best do so? Or, are there some really
obvious reasons why -O3 would make it slow down dramatically? Other
information about the machine /compiler that would help?
Thanks
Robert