RFR: 8338967: Improve performance for MemorySegment::fill [v10]
Francesco Nigro
duke at openjdk.org
Tue Sep 3 08:53:23 UTC 2024
On Tue, 3 Sep 2024 08:39:02 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>> I found similar small improvements to be had (I wrote about them offline) when replacing the bitwise-based tests (e.g. `foo & 4 != 0`) with a more explicit check for `remainingBytes >=4`. Seems like bitwise operations are not as optimized (or perhaps the assembly instructions for them is overall more convoluted - I haven't checked).
>
> I've tried
>
>
> final long longValue = Byte.toUnsignedLong(value) * 0x0101010101010101L;
>
>
> But it had the same performance as explicit bit shifting on M1.
@minborg the ` ELEM_SIZE` is a `Param` field right? Just to be 100% sure of it...
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20712#discussion_r1741681612
More information about the core-libs-dev
mailing list