RFR: 8347009: Speed up parseInt and parseLong [v4]
Shaojin Wen
swen at openjdk.org
Sun Jan 5 07:10:08 UTC 2025
> 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 11 additional commits since the last revision:
- emptyInput -> nullInput
- use CharacterDataLatin1.instance::isDigit
- add comments
- reduce codeSize
- bug fix for bound check
- reduce codeSize
- remove unused code
- code format
- bug fix
- bug fix
- ... and 1 more: https://git.openjdk.org/jdk/compare/9ea08455...fd51c1ce
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/22919/files
- new: https://git.openjdk.org/jdk/pull/22919/files/9ea08455..fd51c1ce
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=22919&range=03
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=22919&range=02-03
Stats: 67 lines in 3 files changed: 17 ins; 12 del; 38 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
More information about the core-libs-dev
mailing list