Summary
Provide public access to DecimalFormatSymbol
's locale to improve caching of DecimalFormatSymbols
in java.util.Formatter
.
Problem
Formatting of numerics in java.util.Formatter takes a significant performance hit due an expensive retrieval (requires a new instance) of the locale's DecimalFormatSymbol
anytime a locale may have changed.
Solution
The retrieval of the DecimalFormatSymbol
can be skipped if java.util.Formatter
can quickly determine that a cached DecimalFormatSymbol
is valid for the current locale. This can be achieved by providing a public accessor to DecimalFormatSymbol.locale
.
Specification
+ /**
+ * {@return locale used to create this instance}
+ *
+ * @since 19
+ */
+ public Locale getLocale() {
+ return locale;
+ }
+
- csr of
-
JDK-8282625 Formatter caches Locale/DecimalFormatSymbols poorly
-
- Resolved
-