<i18n dev> RFR: 8263090: Avoid reading volatile fields twice in Locale.getDefault(Category)

Claes Redestad redestad at openjdk.java.net
Fri Mar 5 16:05:54 UTC 2021


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.

-------------

Commit messages:
 - Add microbenchmark
 - Reduce volatile reads in Locale.getDefault(Category)

Changes: https://git.openjdk.java.net/jdk/pull/2845/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2845&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8263090
  Stats: 92 lines in 2 files changed: 72 ins; 5 del; 15 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2845.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2845/head:pull/2845

PR: https://git.openjdk.java.net/jdk/pull/2845


More information about the i18n-dev mailing list