On Fri, 5 Mar 2021 14:14:14 GMT, Claes Redestad <redes...@openjdk.org> wrote:
> This patch refactors Locale.getDefault(Category) so that the volatile field > holding the Locale is typically only read once. This has a small performance > advantage, and might be more robust if initialization is racy. Results on the provided, simple microbenchmark Baseline: Benchmark Mode Cnt Score Error Units LocaleDefaults.getDefault avgt 5 11.142 ± 0.084 ns/op LocaleDefaults.getDefaultDisplay avgt 5 14.024 ± 0.063 ns/op LocaleDefaults.getDefaultFormat avgt 5 14.001 ± 0.072 ns/op Patch: Benchmark Mode Cnt Score Error Units LocaleDefaults.getDefault avgt 5 11.210 ± 0.057 ns/op LocaleDefaults.getDefaultDisplay avgt 5 12.597 ± 0.022 ns/op LocaleDefaults.getDefaultFormat avgt 5 12.608 ± 0.049 ns/op ------------- PR: https://git.openjdk.java.net/jdk/pull/2845