Re: UUID creation performance

2023-03-06 Thread Roger Riggs
Hi Brett, You might be trying to over optimize, making the source more complex than is useful or necessary. I think it is likely that on most architectures the varhandles take advantage of appropriate machine instructions and both have the same performance. I expect the performance difference

Re: UUID creation performance

2023-03-05 Thread Brett Okken
The new ByteArray class works great for the nameUUIDFromBytes method, which must be in big endian. For randomUUID, byte order does not matter, so using native would be fastest, but there does not appear to be a utility class for that. Is there a preference of just having a native order VarHandle to

Re: UUID creation performance

2023-03-01 Thread Roger Riggs
Hi, That's an interesting idea.  Recently VarHandle access methods were created by JDK-8300236 [1] [2] in the jdk.internal.util package. See the ByteArray and ByteArrayLittleEndian classes. See how that would affect performance and leverage existing VarHandles. Thanks, Roger [1] https://bug

UUID creation performance

2023-03-01 Thread Brett Okken
Is there any interest in updating the static UUID.randomUUID() and UUID.nameUUIDFromBytes(byte[]) factory methods to use either a ByteBuffer or byteArrayViewVarHandle to convert the byte[] to 2 long values then do the bit twiddling? These methods are really dominated by time to create/populate the