What's the purpose of compressed object pointers?

别来无恙 提交于 2020-01-03 11:00:26

问题


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?


回答1:


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




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/6905594/whats-the-purpose-of-compressed-object-pointers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!