RFR: 8196334: Optimize UUID#fromString

Claes Redestad claes.redestad at oracle.com
Sun Mar 1 21:05:17 UTC 2020

On 2020-03-01 20:41, Alan Bateman wrote:
> On 01/03/2020 18:19, Claes Redestad wrote:
>> :
>> After discussing it a bit offline, Andriy and I would like to simplify
>> the dash-checking code a bit to make it more clear, as there seems to be
>> no obvious performance drawback of simplifying to (ch1 == '-' && ...).
>> New webrev: http://cr.openjdk.java.net/~redestad/8196334/open.01/
> This looks good and keeping the old code for the size != 36 case gets 
> around the compatibility issues discussed here with previous attempts to 
> improve it.
> A few minor nits: The effective TODO to optimize Character.digit in the 
> declaration of NIBBLES seems like something for JIRA, not a comment 
> here. I assume the fully qualified class name for java.util.Arrays is 
> because this patch was initially developed outside of java.util? Can 
> parse4Nibbles be moved to after the declaration of NIBBLES to avoid it 
> being in the middle of the two fromString methods?

Filed https://bugs.openjdk.java.net/browse/JDK-8240266 to investigate
if we can improve the branch elimination in Character.digit and removed
the comment.

Also moved parse4Nibbles up before fromString and fixed the redundant
FQDN for Array:




More information about the core-libs-dev mailing list