Unsafe.{get,put}-X-Unaligned performance (original) (raw)
Peter Levart peter.levart at gmail.com
Thu Mar 12 16:52:31 UTC 2015
- Previous message: Unsafe.{get,put}-X-Unaligned performance
- Next message: Unsafe.{get,put}-X-Unaligned performance
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 03/11/2015 06:27 PM, Andrew Haley wrote:
On 03/11/2015 07:10 AM, John Rose wrote:
John: I'm waiting for an answer to my question here before I submit a webrev for approval.
http://mail.openjdk.java.net/pipermail/panama-dev/2015-March/000099.html (Answered.) http://cr.openjdk.java.net/~aph/unaligned.jdk.5/ http://cr.openjdk.java.net/~aph/unaligned.hotspot.5/ I hope everybody is happy with this, or at least not so unhappy that they would want to reject it altogether. There is no bug ID for this yet. John, would you like to create a bug database entry? If not, I'll do so. Then I can go for a RFR, which hopefully should be a shoo-in now that we've beaten this thing to death. :-) Andrew.
Hi Andrew,
Just an observation. In Heap-X-Buffer.java.template, you are using self-sufficient form of methods for integral types:
377 public int getInt() { 378 return unsafe.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian); 379 } 380 381 public int getInt(int i) { 382 return unsafe.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian); 383 }
...but for floating point, you use:
479 public float getFloat() { 480 return getFloat(nextGetIndex(4)); 481 } 482 483 public float getFloat(int i) { 484 int x = unsafe.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian); 485 return Float.intBitsToFloat(x); 486 }
...getFloat() is calling getFloat(int) which is a virtual method with 2 implementations. I think it would be better to in-line the the call and eliminate the need to execute checkIndex()...
Regards, Peter
-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20150312/ea8f264b/attachment.html>
- Previous message: Unsafe.{get,put}-X-Unaligned performance
- Next message: Unsafe.{get,put}-X-Unaligned performance
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the hotspot-compiler-dev mailing list