RFR: 8367324: Avoid redundant parsing when formatting with DigitList
Johannes Graham
duke at openjdk.org
Wed Sep 10 14:03:49 UTC 2025
When formatting doubles or BigDecimals, DigitList first formats them as a string and then parses the resultant string to extract the mantissa and the exponent. This can be done more directly. This allows removing some parsing code and removes a cached byte array.
This also facilitates potential cleanups in FloatingDecimal (removal of getChars method) but I've left that for later to minimize conflicts with other changes there.
-------------
Commit messages:
- unneeded comment
- extract fitsIntoLong method, cleanup test
- Merge branch 'openjdk:master' into digitlist-double4
- remove unused import
- add fast path in BigInteger.toString for values that fit into a long
- add benchmark for BigDecimal formatting
- avoid parsing
Changes: https://git.openjdk.org/jdk/pull/27118/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27118&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8367324
Stats: 140 lines in 5 files changed: 51 ins; 72 del; 17 mod
Patch: https://git.openjdk.org/jdk/pull/27118.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27118/head:pull/27118
PR: https://git.openjdk.org/jdk/pull/27118
More information about the core-libs-dev
mailing list