RFR: 8196334: Optimize UUID#fromString

Alan Bateman Alan.Bateman at oracle.com
Sun Mar 1 19:41:28 UTC 2020


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?

-Alan.


More information about the core-libs-dev mailing list