This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

g++ Long compile times


When I compile the program below with EXTRA_CLASS_OBJECTS equal to 0, the compile time is about 3 seconds. When EXTRA_CLASS_OBJECTS is 1, the compile time is about 12 seconds.

The program is not very smart and repeats a pattern over and over (actually it is a simplification of a program that is automatically generated by a modeling language). It seems to me that the compiler is also not very smart and is repeating some calculation over and over.

The attached file gcc_slow.sh is a bash script that can be used to test this on your system. If you execute
./gcc_slow.sh
you will get a help message that describes how it works.
===================================
# include <cstdlib>
class mydouble {
public:
double value_;
mydouble& operator =(double right);
mydouble operator +(double right);


# if EXTRA_CLASS_OBJECTS
     size_t id_;
     mydouble(void);
     mydouble(size_t x);
     mydouble(int x);
     mydouble(double x);
# endif
};
mydouble mysum(void)
{
     mydouble x_0;
     x_0 = 0;
     mydouble x_1;
     x_1 = x_0 + 1.;
     mydouble x_2;
    ...
     mydouble x_7999;
     x_7999 = x_7998 + 7999.;
     return x_7999;
}

Attachment: gcc_slow.sh
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]