Integrated: 8338967: Improve performance for MemorySegment::fill
Per Minborg
pminborg at openjdk.org
Tue Sep 3 10:28:27 UTC 2024
On Mon, 26 Aug 2024 11:47:11 GMT, Per Minborg <pminborg at openjdk.org> wrote:
> The performance of the `MemorySegment::fil` can be improved by replacing the `checkAccess()` method call with calling `checkReadOnly()` instead (as the bounds of the segment itself do not need to be checked).
>
> Also, smaller segments can be handled directly by Java code rather than transitioning to native code.
>
> Here is how the `MemorySegment::fill` performance is improved by this PR:
>
> 
>
>
> Operations involving 8 or more bytes are delegated to native code whereas smaller segments are handled via a switch rake.
>
> It should be noted that `Arena::allocate` is using `MemorySegment::fil`. Hence, this PR will also have a positive effect on memory allocation performance.
This pull request has now been integrated.
Changeset: 7a418fc0
Author: Per Minborg <pminborg at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/7a418fc07464fe359a0b45b6d797c65c573770cb
Stats: 277 lines in 3 files changed: 274 ins; 0 del; 3 mod
8338967: Improve performance for MemorySegment::fill
Reviewed-by: mcimadamore, psandoz
-------------
PR: https://git.openjdk.org/jdk/pull/20712
More information about the core-libs-dev
mailing list