RFR: 8359424: Eliminate table lookup in Integer/Long toHexString [v8]

Chen Liang liach at openjdk.org
Fri Jan 23 14:45:28 UTC 2026


On Fri, 23 Jan 2026 03:44:38 GMT, Shaojin Wen <swen at openjdk.org> wrote:

>> In PR #22928, UUID introduced long-based vectorized hexadecimal to string conversion, which can also be used in Integer::toHexString and Long::toHexString to eliminate table lookups. The benefit of eliminating table lookups is that the performance is better when cache misses occur.
>
> Shaojin Wen has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Update src/java.base/share/classes/java/lang/Long.java
>    
>    Co-authored-by: Chen Liang <liach at openjdk.org>
>  - Update src/java.base/share/classes/java/lang/Long.java
>    
>    Co-authored-by: Chen Liang <liach at openjdk.org>

src/java.base/share/classes/java/util/UUID.java line 532:

> 530:         ByteArrayLittleEndian.setInt(buf, 19, (int) (x1));
> 531:         ByteArrayLittleEndian.setInt(buf, 24, (int) (x1 >>> 32));
> 532:         ByteArrayLittleEndian.setLong(buf, 28, Long.reverseBytes(HexDigits.hex8Be((int)leastSigBits)));

Casts in this file needs proper formatting too

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22942#discussion_r2721488613


More information about the core-libs-dev mailing list