Following my question on whether the CLR could use compressed pointers, the answer was that it's pretty pointless. Still, some JVMs are implementing it, so what are the concrete benefits of this optimization, since gaining 4 bytes doesn't seem worth it?
-XX:+UseCompressedOops enables the use of compressed 32 bit OOPS in 64 bit JVM which effectively compensates the performance penalty imposed by 64 bit JVM without scarifying heap size advantage offered by them.
UseCompressedClassPointers uses a 32-bit offset to represent the class pointer in a 64-bit process as does UseCompressedOops for Java object references. A region is allocated for these compressed class pointers (the 32-bit offsets).
For 64 bit platforms and Java stacks in general, the recommended Maximum Heap range for WebSphere Application Server, would be between (4096M - 8192M) or (4G - 8G).
There is huge value in compressed references. First, on x86, 64 bit modes unlock 8 new registers to be used, which is a huge performance win. Second, using 4 byte instead of 8 byte headers / object pointers significantly improves cache efficiency. We see real-world benefits in IBM Java on the order of ~5-10% relative to a "full" 64 bit JVM (your mileage will vary). This makes moving to "small 64 bit" heaps an easy and painless thing, breaking past the ~2gb memory limit in 32 bit JVMs. (the real 32 bit limit it could be anywhere from 1700mb to ~3.7gb depending on the OS).
You can gain 4 bytes from every object reference. If object has more references, it's common in java object, you can save more memory. Small object size could cause 2 results, first, the GC pause time is reduced. 2nd, cache hit rate is increased. So java application could gain performance improvement. For benchmark test, enable CompressedOops could improve performance by 5%~10% .
If your main goal is to avoid garbage collections altogether, or at least have less frequent GC runs, it is worth it, since it can lead to substantial lower memory footprints.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With