This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Global variables are slower?
- To: "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
- Subject: Global variables are slower?
- From: Anjul Srivastava <anjul dot srivastava at sanchez dot com>
- Date: Fri, 11 Feb 2000 17:22:49 -0500
Hello folks,
Somebody told me that accessing a global variable requires an extra
instruction, and thus, global variables are slower than local variables.
Is this true for gcc generated code? I'm surprised if it is because I
understood from my knowledge of C that there was no performance difference
between local and global variables.
Can it be optimized out, at least for repeated accesses, if it is true?
Thanks a lot,
Anjul.