RFR: 8315585: Optimization for decimal to string [v7]

Chen Liang liach at openjdk.org
Fri Sep 8 15:44:41 UTC 2023


On Fri, 8 Sep 2023 15:34:16 GMT, 温绍锦 <duke at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/String.java line 699:
>> 
>>> 697:     }
>>> 698: 
>>> 699:     static String newStringLatin1NoRepl(byte[] bytes) {
>> 
>> How much does this help compared to calling `jla.newStringNoRepl(bytes, StandardCharsets.ISO_8859_1)`? Maybe something that would be better split out to a separate enhancement and examined in isolation and apply it in other places where applicable (`java.util.UUID`, `java.util.HexFormat`)
>
> newStringLatin1NoRepl does not significantly help performance, but it simplifies the code. 
> 
> Of course, there is another advantage: because the call will be simpler, making it easier for the caller method to implement codeSize smaller than the default value of FreqInlineSize 325, and there are more opportunities to be inlined.

Notice there is patch https://github.com/openjdk/jdk/pull/14655 (bug 8310901) for converting these usages to a new `newStringLatin1NoRepl`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15555#discussion_r1320028073


More information about the core-libs-dev mailing list