<i18n dev> RFR: 8367324: Avoid redundant parsing when formatting with DigitList [v3]

Johannes Graham duke at openjdk.org
Fri Sep 12 23:01:17 UTC 2025


On Fri, 12 Sep 2025 22:44:54 GMT, Johannes Graham <duke at openjdk.org> wrote:

>> 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.
>
> Johannes Graham has updated the pull request incrementally with one additional commit since the last revision:
> 
>   VALUES_SIZE

BigIntegers benchmark

Baseline

Benchmark                      Mode  Cnt   Score   Error  Units
BigIntegers.testHugeToString   avgt   15  96.249 ± 3.766  ns/op
BigIntegers.testLargeToString  avgt   15  19.919 ± 0.532  ns/op
BigIntegers.testSmallToString  avgt   15  28.000 ± 1.132  ns/op


This PR (fast-path in BigInteger.toString)

BigIntegers.testHugeToString   avgt   15  95.965 ± 1.563  ns/op
BigIntegers.testLargeToString  avgt   15   7.701 ± 0.083  ns/op
BigIntegers.testSmallToString  avgt   15   7.027 ± 0.380  ns/op

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

PR Comment: https://git.openjdk.org/jdk/pull/27118#issuecomment-3287050561


More information about the i18n-dev mailing list