RFR: 8365832: Optimize FloatingDecimal and DigitList with byte[] and cleanup [v4]

Johannes Graham duke at openjdk.org
Wed Aug 20 15:06:42 UTC 2025


On Wed, 20 Aug 2025 14:39:24 GMT, Shaojin Wen <swen at openjdk.org> wrote:

>> Since FloatToDecimal and DoubleToDecimal are used in Float.toString and Double.toString, some code in FloatingDecimal is not used. 
>> 
>> This PR refactors `FloatingDecimal` and `DigitList` to improve efficiency and reduce code duplication.
>> 
>> Key changes:
>> * Convert internal digit storage from `char[]` to `byte[]` for reduced memory footprint.
>> *   Remove unused code and methods that are no longer needed.
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   bug fix

src/java.base/share/classes/jdk/internal/math/FloatingDecimal.java line 219:

> 217:         private int nDigits;
> 218:         private final byte[] digits;
> 219:         private final byte[] buffer = new byte[26];

`buffer` appears to be unused now

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23311#discussion_r2288475808


More information about the core-libs-dev mailing list