On Sun, 5 Jan 2025 11:01:18 GMT, Shaojin Wen <s...@openjdk.org> wrote:

>> This is an optimization for decimal Integer.parseInt and Long.parseLong, 
>> which improves performance by about 10%. The optimization includes:
>> 1. Improve performance by parsing 2 numbers at a time, which has performance 
>> improvements for numbers with length >= 3.
>> 2. It uses charAt(0) for the first number. Assuming that the optimization 
>> can eliminate boundary checks, this will be more friendly to parsing numbers 
>> with length 1.
>> 3. It removes the reliance on the Character.digit method and eliminates the 
>> reliance on the CharacterDataLatin1#DIGITS cache array, which avoids 
>> performance degradation caused by cache misses.
>
> Shaojin Wen has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   vector digit2

src/java.base/share/classes/java/lang/Integer.java line 581:

> 579:     }
> 580: 
> 581:     static boolean isDigitLatin2(int ch) {

Unused, should be removed

src/java.base/share/classes/jdk/internal/util/DecimalDigits.java line 154:

> 152:             Here we are doing a 2-Byte Vector operation on the short 
> type.
> 153: 
> 154:             x & 0xF0 != 0xC0

Suggestion:

            x & 0xF0 != 0x30

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22919#discussion_r1915043154
PR Review Comment: https://git.openjdk.org/jdk/pull/22919#discussion_r1915038981

Reply via email to