On 08/14/2010 06:58 PM, Brad Bell wrote: > The program below is not very smart and repeats a pattern over and over > (it is a simplification of a program that is automatically generated by > a modeling language). It seems that the compiler is also not very smart > and is repeating some calculations over and over. > > When I use g++ to compile the program with > EXTRA_CLASS_OBJECTS=0 > the compile time is about 3 seconds. When > EXTRA_CLASS_OBJECTS=1 > the compile time is about 12 seconds. > (See the end of this message for the output of gcc -v on my system.) > > The attached file gcc_slow.sh is a bash script that can be used to test > this > on any system. If you execute > ./gcc_slow.sh > you will get a help message that describes how it works. > > Are there compile time options for gcc that can significantly reduce the > g++ > compile for EXTRA_CLASS_OBJECTS=1 case in the example program below ? I don't think so. You're asking the C++ front-end to do a lot more work, so it takes a lot more time. Andrew.