RFR: 8294397: Replace StringBuffer with StringBuilder within java.text [v3]
Сергей Цыпанов
duke at openjdk.org
Fri Sep 30 16:18:28 UTC 2022
On Thu, 29 Sep 2022 22:29:43 GMT, Brent Christian <bchristi at openjdk.org> wrote:
>> Justin Lu has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Tweak indentation in PaternEntry
>
> src/java.base/share/classes/java/text/PatternEntry.java line 291:
>
>> 289: // We re-use these objects in order to improve performance
>> 290: private StringBuilder newChars = new StringBuilder();
>> 291: private StringBuilder newExtension = new StringBuilder();
>
> Again, in 2022, I don't know that this cache+reuse pattern is needed for performance.
Due to some [bootstrapping issues](https://stackoverflow.com/questions/71834059/why-invokedynamic-based-string-concatenation-is-not-available-for-javac-in-java) in `java.base` explicit String concatenation is not translated into invokedynamic, so in practice it's faster to use `StringBuilder.append()` than `str1 + str2`, see e.g. https://github.com/openjdk/jdk/pull/3903
-------------
PR: https://git.openjdk.org/jdk/pull/10475
More information about the core-libs-dev
mailing list