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

Thomas Zimmermann duke at openjdk.org
Wed Aug 20 21:28:41 UTC 2025


On Wed, 20 Aug 2025 15:41:25 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:
> 
>   without copy digits, from @j3graham

I'm not an official reviewer, but looks good to me 👍 

P.S.: While looking why you might have preferred `ISO_8859_1` over `US_ASCII` (latin1 can skip the mapping of replacement characters because it defines the entire byte range, correct?), I stumbled upon a reference to the removed `SecurityManager` in [a comment](https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/String.java#L652).

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

Marked as reviewed by zimmi at github.com (no known OpenJDK username).

PR Review: https://git.openjdk.org/jdk/pull/23311#pullrequestreview-3138290097


More information about the core-libs-dev mailing list