On Thu, 23 Feb 2023 15:17:26 GMT, Raffaello Giulietti <[email protected]>
wrote:
>> Add the ability to repeatedly append char and CharSequence data to
>> StringBuilder/StringBuffer.
>
> src/java.base/share/classes/java/lang/AbstractStringBuilder.java line 1851:
>
>> 1849: while (count-- != 0) {
>> 1850: value[index++] = (byte) c;
>> 1851: }
>
> One could reduce to just one running var rather than two:
>
> int index = this.count;
> int limit = index + count;
> for (; index != limit; ++index) {
> value[index] = (byte) c;
> }
True. Will test to see if there is any performance benefit.
-------------
PR: https://git.openjdk.org/jdk/pull/12728