RFR: 8338967: Improve performance for MemorySegment::fill [v10]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Aug 30 14:21:22 UTC 2024


On Fri, 30 Aug 2024 13:53:37 GMT, Francesco Nigro <duke at openjdk.org> wrote:

> this can be u * 0xFFFFFFFFFFFFL if value != 0 and just 0L if not: not sure if fast(er), need to measure.
> 
> Most of the time filling is happy with 0 since zeroing is the most common case

It's a clever trick. However, I was looking at similar tricks and found that the time spent here is irrelevant (e.g. I tried to always force `0` as the value, and couldn't see any difference).

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20712#discussion_r1738762266


More information about the core-libs-dev mailing list