FW: Global variables are slower?

Anjul Srivastava anjul.srivastava@sanchez.com
Fri Feb 11 14:44:00 GMT 2000

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


More information about the Gcc mailing list