RFR: 8196869: Optimize Locale creation

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


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.


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.



More information about the core-libs-dev mailing list