x86-64 on i386 (was Re: Promoting i386 version over x86_64?)

Ralf Corsepius rc040203 at freenet.de
Mon Dec 14 11:51:22 UTC 2009


On 12/14/2009 10:27 AM, Nicolas Mailhot wrote:
>
>
> Le Dim 13 décembre 2009 22:35, Chris Adams a écrit :
>
>> As for the RAM overhead of 64 bit code vs. 32 bit code, I don't see it
>> much in the real world.
>
> The worst case I've seen reported is when the RAM overhead managed to
> annihilate register improvements (worst case in a very specific load). So "RAM
> overhead" is pretty much a urban myth on x86_64

It's not an urban myth - Conversely, it can quite easily be proven:

int main()
{
   long i;
   void *array[1000000];

   for ( i = 0; i < 1000000; i++ ) {
     array[i] = (void*) i;
   };

   while(1) {};
}

Compile this snippet for -m64/-m32:
# gcc -m64 -o test-64 -Wall test.c
# gcc -m32 -o test-32 -Wall test.c


Then run them and watch memory consumption (here "top"):

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND 
 

  5909 corsepiu  20   0 11536 8128  248 R 100.0  0.4   0:16.93 test-64 
 

  5903 corsepiu  20   0  5560 4180  224 R 99.0  0.2   1:10.20 test-32 


QED


Of course, this is an extreme case, but they also aren't "that rare" in 
real world cases.

Ralf




More information about the fedora-devel-list mailing list