RFR 8151163 All Buffer implementations should leverage Unsafe unaligned accessors

Paul Sandoz paul.sandoz at oracle.com
Thu Mar 10 17:06:05 UTC 2016


> On 8 Mar 2016, at 19:27, Paul Sandoz <Paul.Sandoz at oracle.com> wrote:
> 
>>> The changes in this webrev take advantage of those for JDK-8149469
>>> and apply the unsafe double addressing scheme so certain byte buffer
>>> view implementations can work across heap and direct buffers. This
>>> should improve the performance on x86 for:
>> 
>> I understand the idea, but I think we would need to verify this before
>> pushing.
>> 
> 
> Admittedly i am leaning on the rational/motivation for the previous changes to use Unsafe unaligned accessors.
> 
> I less confident about the impact on non-x86 platforms.
> 
> I have some VarHandles related benchmark code [*] i can use to get some numbers.
> 

Here is some prelimiary perf numbers for x86 so far:

  http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8151163-buffer-unsafe-unaligned-access/perf/ArrayViewTest.java

Observations:

- no regression for aligned and misaligned access

- big performance boost for LongBuffer view accesses over a managed ByteBuffer.

- there are some curious smaller differences between ByteBuffer.getLong, LongBuffer.get, direct and managed [*], which may come down to the addressing mode used for access in unrolled loops (and how variables are hoisted out of the loop). Need to analyse the generated code. Those are not blockers and could be swept up in another issue.

I need to run this on SPARC, but so far it is looking good.

Paul.

[*] bb_direct_long_view < bb_direct_long = bb_managed_long < bb_managed_long_view




More information about the core-libs-dev mailing list