RFR: JDK-8310502 : Optimization for j.l.Long.fastUUID() [v26]

Chen Liang liach at openjdk.org
Tue Jun 27 14:17:17 UTC 2023


On Tue, 27 Jun 2023 14:11:41 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> What I suggest is to prepare the array only once (in the static block as it is now), but have each class that use it encapsulate is own copy - obtained from clone(). Surely 256 shorts is not so large that we can't have two arrays?

I really wish we have frozen arrays, which are safely sharable like records. The closest we have right now is a final array with `@Stable`, which indicates array elements are lazy (any non-default value read can be treated as a constant by JIT); since this array is explicitly `@Stable final`, we can share it within the JDK like any other immutable objects.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14578#discussion_r1243822811


More information about the core-libs-dev mailing list