Hi! I hope someone can help me with a (simple but big!) performance problem with a C program.
I'm a computational chemist and I did a C-code which spent much of its time inside a triple loop (few second with the test input data but some day with "real" data).
These loops compute a variable, "sjk", very fast (less than 2 sec.) if I don't put OUT of the loops any instruction like:
But, if I try to visualize this variable with a printf, the code runs very much slower (> 1000 sec.).
I tried to rename it out of the loop etc... I always have the same problem.
I discover also that if "sjk" is declared as a global one, the program runs slowly even thoug I don't use printf.
I think the problem could be some optimization option of the compiler (I compile with gcc -fast on MacOsx Tiger, G4) which can not switched on when I try to print "sjk" or I use it as a global variable.
Do anyone know the reason (and possibly a solution) of my problem?
/* Here I want to print sjk! */