<i18n dev> RFR: 8335791: Speed up j.u.Formatter & String.format [v2]
Shaojin Wen
duke at openjdk.org
Fri Jul 5 20:36:33 UTC 2024
On Fri, 5 Jul 2024 18:56:58 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Shaojin Wen has updated the pull request incrementally with four additional commits since the last revision:
>>
>> - use unknownFormatConversion method construct UnknownFormatConversionException
>> - uppercase static final field name & code format
>> - add stable annotation
>> - replace cast to pattern matching
>
> src/java.base/share/classes/java/lang/String.java line 4548:
>
>> 4546: }
>> 4547:
>> 4548: private static class StringFormat {
>
> Since we want to avoid new classes on startup, we should change the lazy initialization pattern to:
>
>
> private static @Stable JavaUtilFormatterAccess jufa;
> private static JavaUtilFormatterAccess formatterAccess() {
> var access = jufa;
> if (access = null) {
> // We can assert not null on the getJUFA result
> return jufa = SharedSecrets.getJavaUtilFormatterAccess();
> }
> return access;
> }
>
> using benign race.
I found out through `-verbose:class` that StringFormat is not in the class loaded by startup
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20055#discussion_r1667120045
More information about the i18n-dev
mailing list