RFR: 8338591: Improve performance of MemorySegment::copy
Per Minborg
pminborg at openjdk.org
Fri Sep 6 12:07:59 UTC 2024
On Tue, 3 Sep 2024 07:52:44 GMT, Per Minborg <pminborg at openjdk.org> wrote:
> This PR proposes to handle smaller FFM copy operations with Java code rather than transitioning to native code. This will improve performance. In this PR, copy operations involving zero to 63 bytes will be handled by Java code.
>
> Here is what it looks like for Windows x64:
>
> 
>
> Here is another chart for Linux a64:
>
> 
>
> Other platforms exhibit similar behavior. It should be noted that the gain with this PR is pronounced for certain common sizes that are more likely to appear in code (e.g. 8, 16, 24, and 32)
>
> It would be possible to use the same code path for the 7arg `MemorySegment::copy` method if it is similar to:
>
>
> MemorySegment.copy(heapSrcSegment, JAVA_BYTE, 0, heapDstSegment, JAVA_BYTE, 0, ELEM_SIZE);
>
>
> This could be added in a separate PR.
>
> This PR has been tested with tier1-3 and passed.
> Wdyt about the benchmark I have added at [#20829 (comment)](https://github.com/openjdk/jdk/pull/20829#issuecomment-2326404582)? Sadly I didn't yet run against this PR
Let's see what we can do about this later.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20829#issuecomment-2333908071
More information about the core-libs-dev
mailing list