RFR: 8196334: Optimize UUID#fromString

Ivan Gerasimov ivan.gerasimov at oracle.com
Fri Feb 28 19:51:41 UTC 2020

Hi Claes and Andriy!

It looks good overall.

I wonder if it'll be even faster if the fast path were implemented in 
StringLatin1 (for compact strings only) and was called via 

Then, you could operate directly on bytes and avoid dealing with longs.

With kind regards,


On 2/28/20 6:22 AM, Claes Redestad wrote:
> Hi all,
> please review this patch to optimize UUID#fromString.
> Jon Chambers originally proposed a patch that used a strict parser to
> get a similar speed-up, but I failed to adapt it in a way that
> could fall back to the less strict behavior while maintaining a
> reasonable speed-up in the fast-path case. Sorry, Jon!
> The patch proposed here was recently contributed by Andriy Plokhotnyuk
> (OCA signed), and manages to get more than a 3x speed-up on the new
> fromString microbenchmark, while falling back gently to the current,
> less strict implementation if ever needed. I've done some light edits,
> and added a simple microbenchmark.
> Bug:    https://bugs.openjdk.java.net/browse/JDK-8196334
> Webrev: http://cr.openjdk.java.net/~redestad/8196334/open.00/
> Testing: tier1-3
> Thanks!
> /Claes

With kind regards,
Ivan Gerasimov

More information about the core-libs-dev mailing list