This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Global variables are slower?
- To: dvv at egcs dot dvv dot ru, anjul dot srivastava at sanchez dot com
- Subject: Re: Global variables are slower?
- From: N8TM at aol dot com
- Date: Fri, 11 Feb 2000 18:11:52 EST
- CC: gcc at gcc dot gnu dot org
>The program is (yes, I should have used volatile, but I am sure that gcc
>cannot optimize this case to the extent a human can):
>
>#include <stdio.h>
>
>int i; int main() { int a,j; a=0;
>for(j=0;j<1000;j++) for(i=0;i<1000000;i++) a+=i;
gnu compilers don't emphasize optimization of things like this which matter only in poorly written benchmarks; they concentrate more on useful things. Not that many compilers would find the value of a which you should know from high school algebra. Definitely a case where a human could optimize better than any compiler, but many compilers will do more than gcc.
Tim
tprince@computer.org