RFR: 8294397: Replace StringBuffer with StringBuilder within java.text [v3]

Roger Riggs rriggs at openjdk.org
Fri Sep 30 17:36:24 UTC 2022


On Fri, 30 Sep 2022 16:52:40 GMT, Brent Christian <bchristi at openjdk.org> wrote:

>> 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
>
> Thanks. I was not suggesting that we use string concatenation, but rather just remove the `newChar`/`newExtension` fields, and replace, e.g.:
> `214             newChars.setLength(0);`
> with
> `214            StringBuilder newChars = new StringBuilder();`
> though I'll admit that I don't have a good sense of whether that's worth doing.

Memory you don't allocate doesn't need to be GC'd.  I'd leave it alone and save the GC overhead.

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

PR: https://git.openjdk.org/jdk/pull/10475


More information about the core-libs-dev mailing list