Por que alguns aplicativos são executados mais rapidamente em uma VM guest de 32 bits do que na máquina host de 64 bits?

4

Eu tenho um laptop Windows 7 x64 com uma máquina virtual convidada Windows XP x32 instalada usando o VirtualBox. Uma vez eu corri um aplicativo no guest e descobri que ele rodava visivelmente mais rápido do que no host. Por que isso seria?

    
por user125900 31.03.2012 / 21:43

2 respostas

4

Como você menciona o Java, qual é a versão da sua JVM e está sendo executada no modo de 32 ou 64 bits no host?

Compressed Oops

An "oop", or ordinary object pointer in Java Hotspot parlance, is a managed pointer to an object. An oop is normally the same size as a native machine pointer, which means 64 bits on an LP64 system. On an ILP32 system, maximum heap size is somewhat less than 4 gigabytes, which is insufficient for many applications. On an LP64 system, the heap used by a given program might have to be around 1.5 times larger than when it is run on an ILP32 system. This requirement is due to the expanded size of managed pointers. Memory is inexpensive, but these days bandwidth and cache are in short supply, so significantly increasing the size of the heap and only getting just over the 4 gigabyte limit is undesirable.

Managed pointers in the Java heap point to objects which are aligned on 8-byte address boundaries. Compressed oops represent managed pointers (in many but not all places in the JVM software) as 32-bit object offsets from the 64-bit Java heap base address. Because they're object offsets rather than byte offsets, they can be used to address up to four billion objects (not bytes), or a heap size of up to about 32 gigabytes. To use them, they must be scaled by a factor of 8 and added to the Java heap base address to find the object to which they refer. Object sizes using compressed oops are comparable to those in ILP32 mode.

The term decode is used to express the operation by which a 32-bit compressed oop is converted into a 64-bit native address into the managed heap. The inverse operation is referred to as encoding.

Compressed oops is supported and enabled by default in Java SE 6u23 and later. In Java SE 7, use of compressed oops is the default for 64-bit JVM processes when -Xmx isn't specified and for values of -Xmx less than 32 gigabytes. For JDK 6 before the 6u23 release, use the -XX:+UseCompressedOops flag with the java command to enable the feature.

O tamanho maior de memória das JVMs de 64 bits tem implicações de desempenho muito significativas.

    
por 01.04.2012 / 02:58
3

Os aplicativos podem ser mais rápidos na VM devido ao armazenamento em cache. Como a VM armazena seus discos em arquivos, o sistema operacional do host pode armazenar esses arquivos na RAM e eles funcionarão mais rapidamente. A diferença do mundo real entre aplicativos de 32 e 64 bits é de algumas porcentagens.

    
por 01.04.2012 / 00:10