RFR: 8369312: Refactor Float.toHexString() to avoid use of regex
Joe Darcy
darcy at openjdk.org
Tue Oct 14 15:59:58 UTC 2025
On Tue, 14 Oct 2025 06:43:05 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> Are you planning to add a micro benchmark to go with this?
No; this code path is not performance sensitive, but the new code should run faster.
Hex floating-point output, while informative for testing and debugging, is not commonly used. Subnormal values, the subset of numbers affected here, are rarer still, so it is a corner-case squared situation.
>From a recent refactoring in Float16, one of the reviewers questioned the use of regular expressions for this kind of low-level code and it seemed reasonable to replace the idiom with plain string operations.
(If performance were a concern, we would replicate the tricky logic present to handle double subnormals.)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27780#issuecomment-3402564984
More information about the core-libs-dev
mailing list