RFR: 8196869: Optimize Locale creation

Peter Levart peter.levart at gmail.com
Wed Feb 7 15:01:40 UTC 2018

Hi Claes,

On 02/07/2018 03:23 PM, Claes Redestad wrote:
> Updated webrev:
> http://cr.openjdk.java.net/~redestad/8196869/jdk.02/
> - use map.remove(entry.getKey(), entry) instead of 
> map.remove(entry.getKey())
> - for most Locales, Locale$LocaleKey.exts is null, so using the 
> BaseLocale as key
>   directly in Locale allows us to avoid loading Locale$LocaleKey 
> except in exceptional
>   circumstances.
> - use map.replace to safely update the entry when putIfAbsent returns 
> an object
>   but it points to a cleared value, so that (benign) races to create 
> new Locale objects
>   will canonicalize 

I don't know it it's only me, but I see an old version of 
LocaleObjectCache in webrev at above URL.

Regards, Peter

More information about the core-libs-dev mailing list