Performance issues
ilya lomov
lomov1@yahoo.com
Sat Nov 30 08:58:00 GMT 2002
There is following program:
----------------
struct str{
int f0;
int f1;
int f2;
};
main () {
double d;
double* pd=&d;
str s;
int* pf=&s.f0;
s.f0=s.f1=s.f2=0;
for (int i=0;i<1000000000;++i) {
#ifdef SLOW
pd[s.f0+s.f1*s.f2]=1;
#else
pd[pf[0]+pf[1]*pf[2]]=1;
#endif
}
}
-------------------------------------------
after compilation with gcc-3.2 -O9 on Linux Mandrake 9.0 Athlon 900MHz,
time ./a.out of the SLOW version gives 10.40s
time ./a.out of the "!defined(SLOW)" version gives 3.50s
Logically this is almost the same... Can anyone give me insights what is going on and some advice
how to accelerate SLOW version?
Ilya
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
More information about the Gcc
mailing list