Integrated: 8370013: Refactor Double.toHexString to eliminate regex and StringBuilder

Shaojin Wen swen at openjdk.org
Fri Oct 24 00:43:15 UTC 2025


On Tue, 14 Oct 2025 23:26:00 GMT, Shaojin Wen <swen at openjdk.org> wrote:

> This PR refactors the Double.toHexString method to improve its performance by eliminating the use of StringBuilder and regex operations. The new implementation uses a direct byte array approach to construct the hex string representation, which avoids the overhead of StringBuilder operations and regex pattern matching.
> 
> Existing tests in `java/lang/Double/ToHexString.java`.

This pull request has now been integrated.

Changeset: 58623589
Author:    Shaojin Wen <swen at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/586235896536cde293402167775d4d60f1426a9e
Stats:     291 lines in 4 files changed: 157 ins; 101 del; 33 mod

8370013: Refactor Double.toHexString to eliminate regex and StringBuilder

Reviewed-by: rgiulietti, darcy

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

PR: https://git.openjdk.org/jdk/pull/27811


More information about the core-libs-dev mailing list