RFR: 8370013: Refactor Double.toHexString to eliminate regex and StringBuilder [v10]

Shaojin Wen swen at openjdk.org
Tue Oct 21 04:09:40 UTC 2025


> 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`.

Shaojin Wen has updated the pull request incrementally with two additional commits since the last revision:

 - fix test, from @jddarcy
 - extract doubleToLongBits, from @jddarcy

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/27811/files
  - new: https://git.openjdk.org/jdk/pull/27811/files/c15580f3..cd87ae61

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=27811&range=09
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27811&range=08-09

  Stats: 19 lines in 2 files changed: 5 ins; 0 del; 14 mod
  Patch: https://git.openjdk.org/jdk/pull/27811.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27811/head:pull/27811

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


More information about the core-libs-dev mailing list