RFR: 8334328: Reduce object allocation for FloatToDecimal and DoubleToDecimal [v13]
Raffaello Giulietti
rgiulietti at openjdk.org
Wed Jun 26 12:53:16 UTC 2024
On Tue, 25 Jun 2024 17:02:10 GMT, Shaojin Wen <duke at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/math/DoubleToDecimal.java line 236:
>>
>>> 234: dk = -1;
>>> 235: }
>>> 236: return toDecimal(str, index, Q_MIN, t, dk, fd) - start;
>>
>> I suggest restoring the original logic like so:
>>
>> /* subnormal value */
>> return (t < C_TINY
>> ? toDecimal(str, index, Q_MIN, 10 * t, -1, fd)
>> : toDecimal(str, index, Q_MIN, t, 0, fd)) - start;
>
> I like the new implementation, the code is cleaner, is your suggestion to revert to the original version due to smaller changes?
In principle, you should not arbitrarily change code that is correct, and only limit your changes to reach the goal of the PR.
My suggestion is the minimal change required, yours is more than strictly needed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19730#discussion_r1654762216
More information about the core-libs-dev
mailing list