<i18n dev> RFR: 8294397: Replace StringBuffer with StringBuilder within java.text [v2]

Brent Christian bchristi at openjdk.org
Thu Sep 29 22:34:24 UTC 2022


On Thu, 29 Sep 2022 22:15:00 GMT, Justin Lu <duke at openjdk.org> wrote:

>> Problem: Unnecessary instances of StringBuffer within java.text (internal only)
>> 
>> Fix: StringBuffer Replaced with StringBuilder, and adjusted variable/method names
>
> Justin Lu has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Adjust typo within test description

src/java.base/share/classes/java/text/DigitList.java line 808:

> 806:         }
> 807:         return tempBuilder;
> 808:     }

Is it worth considering whether it's still necessary to cache and reuse a single String[Buffer|Builder] instance when using 2022 garbage collectors?

src/java.base/share/classes/java/text/PatternEntry.java line 117:

> 115:                      boolean showExtension,
> 116:                      boolean showWhiteSpace,
> 117:                      PatternEntry lastEntry)

Nit: update the indentation on these lines

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.

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

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


More information about the i18n-dev mailing list