On Sat, 29 Jun 2024 16:17:32 GMT, David Schlosnagle <d...@openjdk.org> wrote:
>> Shaojin Wen has updated the pull request incrementally with four additional >> commits since the last revision: >> >> - Update src/java.base/share/classes/java/lang/StringFormat.java >> >> Co-authored-by: David Schlosnagle <schlo...@gmail.com> >> - Update src/java.base/share/classes/java/lang/StringFormat.java >> >> Co-authored-by: David Schlosnagle <schlo...@gmail.com> >> - Update src/java.base/share/classes/java/lang/StringFormat.java >> >> Co-authored-by: David Schlosnagle <schlo...@gmail.com> >> - Update src/java.base/share/classes/java/lang/StringFormat.java >> >> Co-authored-by: David Schlosnagle <schlo...@gmail.com> > > src/java.base/share/classes/java/lang/StringFormat.java line 110: > >> 108: width0 = conv0 - '0'; >> 109: if (off0 + 2 < max) { >> 110: conv0 = format.charAt(off0 + 2); > > is it worth handling `width0 > 9`? > > Suggestion: > > for (int i = 2; conv0 >= '1' && conv0 <= '9' && off0 + i < max; i++) { > width0 = (width0 * 10) + (conv0 - '0'); > if (off0 + i < max) { > conv0 = format.charAt(off0 + i); This is the fastpath code. I think it doesn't need to handle width > 9. Keep it small enough to reduce the fallback cost and leave room for supporting more others. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19956#discussion_r1659912461