RFR: 8347009: Speed up parseInt and parseLong [v21]
Shaojin Wen
swen at openjdk.org
Tue Jun 10 01:53:35 UTC 2025
On Fri, 2 May 2025 03:53:23 GMT, Shaojin Wen <swen at 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 with a new target base due to a merge or a rebase. The pull request now contains 39 commits:
>
> - Merge remote-tracking branch 'upstream/master' into optim_parse_int_long_202501
>
> # Conflicts:
> # src/java.base/share/classes/java/lang/Integer.java
> # src/java.base/share/classes/java/lang/Long.java
> - Merge remote-tracking branch 'upstream/master' into optim_parse_int_long_202501
> - remove ForceInline
> - fix comments
> - fix comments
> - Update src/java.base/share/classes/jdk/internal/util/DecimalDigits.java
>
> Co-authored-by: Raffaello Giulietti <raffaello.giulietti at oracle.com>
> - copyright
> - fix JdbExprTest
> - Update src/java.base/share/classes/java/lang/Long.java
>
> Co-authored-by: Raffaello Giulietti <raffaello.giulietti at oracle.com>
> - Update src/java.base/share/classes/java/lang/Integer.java
>
> Co-authored-by: Raffaello Giulietti <raffaello.giulietti at oracle.com>
> - ... and 29 more: https://git.openjdk.org/jdk/compare/bd7c7789...047e1709
keep alive
-------------
PR Comment: https://git.openjdk.org/jdk/pull/22919#issuecomment-2957461147
More information about the core-libs-dev
mailing list