On Mon, 27 Jan 2025 06:03:17 GMT, Shaojin Wen <[email protected]> wrote:
>> src/java.base/share/classes/java/math/BigDecimal.java line 3538:
>>
>>> 3536: return (signum < 0 ? "-0." : "0.").concat(intString);
>>> 3537: } else if (insertionPoint > 0) { /* Point goes inside intVal
>>> */
>>> 3538: buf = new StringBuilder();
>>
>> Could calculate the precise size for the StringBuilder
>
> The performance will degrade if you precompute the length of the
> StringBuilder.
That’s interesting - should the precomputed lengths be removed in the other
ones as well?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23310#discussion_r1930371369