This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
FW: Global variables are slower?
- To: "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
- Subject: FW: Global variables are slower?
- From: Anjul Srivastava <anjul dot srivastava at sanchez dot com>
- Date: Fri, 11 Feb 2000 17:43:11 -0500
-----Original Message-----
From: N8TM@aol.com [mailto:N8TM@aol.com]
Sent: Friday, February 11, 2000 5:30 PM
To: Anjul Srivastava
Subject: Re: Global variables are slower?
>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.
Global variables usually must be static. gnu compilers don't do as much
register optimization of static variables as many commercial compilers do,
although the differences may be minor on x86 architectures, where gcc does
quite well considering the hardware. Evidently sticking my neck out on a
matter where personal experience may make quite a difference.
Tim
tprince@computer.org