RFR: 8196869: Optimize Locale creation

Claes Redestad claes.redestad at oracle.com
Tue Feb 6 17:51:22 UTC 2018


Hi,

we can refactor sun.util.locale.BaseLocale+LocaleObjectCache to minimize 
the number of SoftReferences created in Locale::<clinit> and when 
looking up already defined BaseLocales inside the Locale constructor.

http://cr.openjdk.java.net/~redestad/8196869/jdk.00/

This is mainly a tiny startup optimization, dropping executed bytecode 
during startup by a few thousand and reducing the minimum retained heap 
by a few Kb, but also speeds up microbenchmarks repeatedly calling the 
Locale constructor by ~1.25x. Tests stressing that dereferenced Locales 
are disposed of promptly remain happy.

Thanks!

/Claes



More information about the core-libs-dev mailing list