On Fri, 3 Mar 2023 19:04:22 GMT, Jim Laskey <jlas...@openjdk.org> wrote:
>> Add the ability to repeatedly append char and CharSequence data to >> StringBuilder/StringBuffer. > > Jim Laskey has updated the pull request incrementally with one additional > commit since the last revision: > > Expand test for StringBuffer and illegal code points It seems reasonable to consider analogous `insert` methods. Perhaps a more consistent naming scheme would be `appendRepeated` and `insertRepeated`? (The precedent for `repeat` in `String::repeat` is there, but is kind of weak since it's clear in that case that we're not mutating internal state) src/java.base/share/classes/java/lang/AbstractStringBuilder.java line 1832: > 1830: if (isLatin1 && StringLatin1.canEncode(c)) { > 1831: byte b = (byte)c; > 1832: for (int index = this.count; index < limit; index++) { This loop could even be replaced with `Arrays.fill(value, this.count, limit, b)` - a plausible candidate for intrinsification? There's an added range check in that method, however, but that shouldn't be too hard for the JIT to eliminate. ------------- PR: https://git.openjdk.org/jdk/pull/12728