开发者

What's the purpose of compressed object pointers?

开发者 https://www.devze.com 2023-03-24 17:24 出处:网络
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 benefi

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消