On Sun, 10 Nov 2024 08:58:18 GMT, Shaojin Wen <s...@openjdk.org> wrote:
>> Move getChars methods of StringLatin1 and StringUTF16 to DecimalDigits to >> reduce duplication >> >> 1. HexDigits and OctalDigits also include getCharsLatin1 and getCharsUTF16 >> 2. Putting these two methods into DecimalDigits can avoid the need to expose >> them in JavaLangAccess >> 3. Eliminate duplicate code in BigDecimal > > Shaojin Wen has updated the pull request incrementally with one additional > commit since the last revision: > > add benchmark This PR will improve the performance of Integer/Long.toString and StringBuilder.append(int/long) scenarios. This is because Unsafe.putByte is used to eliminate array bounds checks, and of course this elimination is safe. In previous versions, in Integer/Long.toString and StringBuilder.append(int/long) scenarios, `-COMPACT_STRING` performed better than `+COMPACT_STRING`. This is because StringUTF16.getChars uses StringUTF16.putChar, which is similar to Unsafe.putChar, and there is no bounds check. ------------- PR Comment: https://git.openjdk.org/jdk/pull/21593#issuecomment-2467068731