> 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 48 commits: - Merge remote-tracking branch 'upstream/master' into optim_parse_int_long_202501 - Optimize parseInt/parseLong by inlining digit2 logic - Inline DecimalDigits.digit2() to avoid method call overhead - Remove dependency on lookup tables, use direct calculation - Simplify conditional checks in parsing loops - CodeSize remains < 325 (JIT inlineable) - Performance: Integer.parseInt +6.7%, Long.parseLong +7.1% - from @RogerRiggs - from @liach - Merge branch 'master' into optim_parse_int_long_202501 - remove unsafe - Merge remote-tracking branch 'upstream/master' into optim_parse_int_long_202501 - Merge remote-tracking branch 'origin/optim_parse_int_long_202501' into optim_parse_int_long_202501 - 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 - ... and 38 more: https://git.openjdk.org/jdk/compare/7ecd0eae...acdeb04e ------------- Changes: https://git.openjdk.org/jdk/pull/22919/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22919&range=29 Stats: 205 lines in 6 files changed: 120 ins; 66 del; 19 mod Patch: https://git.openjdk.org/jdk/pull/22919.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/22919/head:pull/22919 PR: https://git.openjdk.org/jdk/pull/22919
