RFR: 8335366: Improve String.format performance with fastpath [v5]
Shaojin Wen
duke at openjdk.org
Sat Jun 29 19:13:18 UTC 2024
On Sat, 29 Jun 2024 19:05:18 GMT, David Schlosnagle <duke at openjdk.org> wrote:
>> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
>>
>> private method & field
>
> src/java.base/share/classes/java/lang/StringFormat.java line 48:
>
>> 46: static String format(String format, Object... args) {
>> 47: if (args != null) {
>> 48: int off = format.indexOf('%');
>
> nit: instead of not null check, should this short circuit for null/empty args?
>
> Suggestion:
>
> if (args == null || args.length == 0) {
> // no formatting to be done
> return format;
> }
>
> int off = format.indexOf('%');
j.u.Formatter supports args == null
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19956#discussion_r1659964303
More information about the core-libs-dev
mailing list