RFR: 8367324: Avoid redundant parsing when formatting with DigitList [v3]
Raffaello Giulietti
rgiulietti at openjdk.org
Wed Sep 24 09:51:25 UTC 2025
On Wed, 10 Sep 2025 23:54:31 GMT, Johannes Graham <duke at openjdk.org> wrote:
>> 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.
@j3graham @justin-curtis-lu I'm fine with this change going in this PR.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27118#discussion_r2374921602
More information about the core-libs-dev
mailing list