This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

FW: Global variables are slower?




-----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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]