RFR: 8367324: Avoid redundant parsing when formatting with DigitList [v2]

Johannes Graham duke at openjdk.org
Wed Sep 10 23:57:21 UTC 2025


On Wed, 10 Sep 2025 21:19:32 GMT, Justin Lu <jlu at openjdk.org> wrote:

>> Johannes Graham has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - use Level.Invocation
>>  - review fixes
>
> src/java.base/share/classes/java/math/BigInteger.java line 4184:
> 
>> 4182: 
>> 4183:         if (fitsIntoLong()) {
>> 4184:             return Long.toString(longValue(), radix);
> 
> We may want to consider separating this `BigInteger` fast path from this PR/change, since it is independent of the speedup in the `DigitList` changes. Others may not have a problem with it though, so maybe we can wait and see what they say.

Without the fast-path, there was a performance drop with the "small" BigDecimals (from memory about 10%). That's what drove me to tinker with `BigInteger.toString`. But if this one can stand on its own, despite the perf drop, I'm happy to separate out the BigInteger part. I'll generate some new perf numbers after the Level.Invocation fix.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27118#discussion_r2338186267


More information about the core-libs-dev mailing list